Use Vim as a simple IDE

Vim already has all functionalities to use it as an IDE.

Vim already has all functionalities to use it as an IDE.

Everybody can install an IDE and use it, but how to use vim as an IDE? I’ll show you settings, shortcuts and features of vim, which turns it into an IDE without using plugins or magic, just plain vim features.

These are the features I’ll focus on:

  • Features out of the box:
    • Basic usages: Open, save, close, …
    • File explorer
    • Create tabs and use them
    • Split the window
  • Navigation in vim:
    • Find, replace, …
    • Jump (e.g. to the next occurrence, definition, …)
  • Build and run software
    • Debugging
  • Create own settings:
    • Line numbers, syntax highlighting, highlight cursor line, …
    • Auto completion in a drop-down menu

These are all adjustments to vim.

Basic usage

Even if you should be familiar with the modes in vim, here’re are some basic commands:

Open a file (without tabs): :e /path/to/file
Save a file: :w
Close a file: :q and without saving :q!
Show information on a command: :help command

Built-in File explorer

(more…)

Parsing command line arguments in Bash

Parsing arguments is not that difficult. Not even in bash scripts.

Parsing arguments is not that difficult. Not even in bash scripts.

There’re many ways to parse arguments that were passed to a bash script. I’ll show two similar methods to parse the parameter schema -o /foo/ and --output=/foo/. The second example can also handle commands.

String manipulation just using Bash

If you’re not familiar with manipulation of string (like ${var#=*} or similar) keep on reading. We’ll select sub-strings from the arguments in the following scripts. The command to do so looks like this: ${<VARIABLE><SPLIT-CHARS><REGEX>}

The split chars define what the result is, which is always one single string. There’re four different ones: (more…)

From Windows to Linux: Prejudices and hurdles

This is Tux. Tux is the mascot of Linux.

This is Tux. Tux is the mascot of Linux.

All the time I hear people saying “I don’t switch to Linux, it’s too complicated for me” or “Nah, Linux is only something for hackers!”. I will show some aspects where Windows ans Linux differ the most. When you switch from Windows to Linux, these are the things you’ll probably notice.

In this post I’ll focus on user-friendly desktop distributions like Ubuntu, Linux Mint or Fedora. Things may look different on other distributions like Arch or Gentoo.

This post is made for non-techies and not for people who already use Linux.

Very briefly: Technical aspects of Linux

Don’t worry, it won’t hurt.

Linux is basically just the inner core (so called “kernel“) of an operating system and should be called “GNU/Linux” (on Windows it’s “NT”), but that’s a different story.

A distribution puts the kernel, applications and a user interface together and distributes it as a fully functional operating system, which can be installed on a computer.

Still use Windows applications/documents?

Many applications you know are available for linux

Many applications you know are available for linux

One point of criticism voiced is: “But there’s no Office/Outlook/Skype/this/that/… for Linux!” This if sometimes true: Microsoft Office is not available for Linux. But it’s not true that you can’t open a docx-document on Linux. LibreOffice is your friend here 😉

The general rule is that there’s most of the time (if not always) an alternative for Linux. Of course, special software might not be available for Linux. Also Microsoft doesn’t offer much support for Linux.

Here’s the thing: You actually can use Windows applications in Linux. There’s a tool called “wine” which enables you to run for example Photoshop and also older games. I can play Skyrim for example without problems.

Playing games

As I mentioned above, you can run Windows applications on Linux (and therefore games for Windows as well) using wine. There’re losses in performance but at least it works.

Fortunately, there’re more and more games available that run natively on Linux. Just to name a few from my Steam-library (because yes, Steam is available for Linux): Bioshock Infinite, The Whitcher 2, GRID Autosport, Factorio, DOTA 2, Civilization V, …

Installation

The installation of a Linux-distribution is pretty simple:

  1. Download an ISO-image of the distribution
  2. Copy it onto a USB-stick or burn it onto a CD/DVD
  3. Restart your computer and boot from the stick/CD/DVD
    (check your motherboards manual to see how to boot from a storage medium. The internet might help as well 😉 )
  4. Follow the instructions
  5. Restart and enjoy

It might be helpful to have a second computer (or smartphone) to look up things in the internet or to have a tutorial open. With the help of the YouTube and search engines it’s absolutely doable.

For a detailed tutorial, search for the installation process of the distribution you’ve chosen, that shows how exactly to complete specific steps.

Install software/driver/applications afterwards

If your computer has totally new or hpelessly outdated hardware installed, everything should work out of the box. Your heard me right: Normally you don’t have to install any drivers. If you want to get the last peace of performance out of your graphics card or do you have a special sound card installed, a special driver might be helpful. Just look at the page of the manufacturer and wait until I described how to install software 😉

Normal applications (like a browser or mail-client) are also pre-installed. Most distributions are using Firefox, Thunderbird and LibreOffice. Also image- and document-viewer are already there.

If you miss something, just install ist (see below for more information in installing software).

Virus scanners

Short version: Normally you won’t need it.

Why?
Linux is not widely used and has less area for attacks. You can only install software as an administrator (see below) and a normal user has too few rights for a virus to cause major damage. Of course, a virus could encrypt files, but a backup saves you from most of the possible attacks.

Yes, security holes are everywhere, but with a bit of common sense, nothing really bad should happen.

Installing and updating software

This is fundamentally different to Windows and an enormous advantage of Linux, regarding security aspects and user experience.

Linux uses so called package managers, a tool, that installs applications (sometimes also called packages) and manages them.

If you want to install an application, first look into the available packages of your package manager. Every distribution has nice applications similar to the app- or play-store. The distribution Linux Mint calls it “Software manager”, which lets you search for applications and installs/updates them for you.

If you can’t find a specific application, the best is to look on the internet how to make it available in the package manager. Only if there’s no possibility of making it available in the package manager, use the manufacturers page to download the application manually (this should always be the last option to choose from!).

To install updates, use the package manager. If you don’t get any notifications (e.g. a popup-window near the taskbar), just have a look every couple of days if there’re available updates. Installing them is quite easy: Click on the button in the software manager application and wait until everything is installed. When updating normal applications no restart of your computer is needed.

For installing and updating applications, you’ll need the system administrator’s rights (see below under “Rights of users”).

Look and feel of the user interface

This depends very much on the distribution you use and you’ll notice the difference to Windows: There’s not the one user interface everybody has to use. Many people have many needs and wishes and therefore many different user interfaces exist.

The most common interfaces are Gnome, KDE, Mint or Cinnamon. They have a quite similar structure: Normal windows, start menu, taskbar, desktop icons, etc. The switch to Linux might not be that hard.

If you don’t like the interface you’re using, just use the package manager to install a new one. Logout after installation, choose the new interface in the menu and login. You’re now working with the new interface.

Same applies for normal applications: You always have the opportunity to try out alternatives and see whether you like it or not.

Where are “My Documents”, Applications and my USB-stick?

Windows assigns a letter for every storage medium. Everybody knows C:\ and maybe you have a backup-partition D:\ or an external harddrive E:\. Linux does not know any of that, instead you have a root-folder in which everything is stored. Important note: Linux uses a forward slash “/” whereas windows uses a backslash “\”.

The folder “My Documents” is called home-folder in Linux and has the path /home/username/. This folder has typically sub-folders like /Pictures/ or /Documents/. You have all rights in your home folder, which means that you normally can do everything you like in this folder: write, read, create, delete, … You don’t have access to other users home-folder.

Applications however have different storage locations and depends on what kind of application it is and what distribution you use. You actually don’t need to know where an application is stored and you should definitely not change anything in those folders. Anyway, applications could be stored in a folder like/usr/share//usr/lib//usr/local/ or /opt/.

When you plug in an USB-stick (or any other storage device) you normally have to “mount” this device. This is a process in which you tell your operating system to use a specific device with specific characteristics. Most distributions are mounting storage devices automatically. In your file explorer you’ll see the storage medium which is available under a certain folder like /media/MY-STICK/.

Rights of users

The rights management is a pretty technical topic but here’re just a few hints:

The following rights on a file or folder can be applied to the owner, a group or everybody:

  • Read – Allows someone to open the file an read its content or to list the content of a folder
  • Write – Allows someone to change to content of a file or to create one in a folder
  • Execute – Allows someone to execute an application or to access a folder

A normal user doesn’t have many rights outside his/her home-folder. Maybe executing or reading is allowed to some files/folders.

When a user is registered in a special file called the sudoers-file, he/she has super-user rights. That may sound pretty elitist and so it is. Such user has the rights of the super-user or also called root (which is basically the system administrator). After entering the password, the root user is allowed to nearly do everything. Someone having this right should note that great responsibility comes with such a great power! Executing an application with such rights is called executing it “as root” (by this is meant that the applications has the same rights like the root-user).

But what can a user with root-rights do more than a normal user? For example: Changing nearly all files, manage devices, install/remove/update software, configure the whole system, create/manage/delete users, assign rights to users, and much more.

Beware 1: If an application does not need root rights, don’t execute it as root. Some applications won’t event start with root rights. When an applications contains a virus, the whole system is in danger.

Beware 2: When installing applications as root user, don’t install any applications downloaded from a dubious website. Always use the package manager and reputable package sources. Again: When the installer of an applications contains a virus and you execute it with root rights, the whole system is in danger.