Using the Terminal – Part 1

Using the Terminal – Part 1

I already introduced the Terminal to you in my previous posts. This post is going to describe the Terminal a bit more in Detail, but I am going to start it slowly, very low learning curve.

What is the Terminal?

The Terminal or Terminal Emulator, sometimes also referred to as Shell, Console, Command Line, is a text-based interface to communicate with your computer system. Plainly said, it’s a program that lets you tell your computer what to do and lets your computer answer.

Every Linux distribution comes with at least one Terminal application pre-installed. Stock Ubuntu has three, the GNOME Terminal, XTerm and UXTerm, their appearance is quit similar and so is their basic function cause they all use the same commands to communicate with the system, for now let’s say they all “speak the same language”. The type of Terminal application(s) you get depends on your distribution or Desktop Environment but they will only differ slightly in appearance and additional features but not in their functions since they “speak the same language”. It’s actually a bit more complicated but this is enough for you to know for now, I will write a bit more in in the second part.

The default Terminal is often opened with CTRL+ALT+T. You also find it in your application launcher when you search for Terminal. Often it is already linked in your “task bar”. Here you can see my GNOME Terminal in Unity
Bildschirmfoto vom 2015-04-01 20:10:12
It might not look like yours after installation but that’s just settings, changing colors and add different backgrounds or transparency is a feature of many Terminal applications.

In addition to that Linux has six virtual consoles, they are like the Terminal without a graphical user interface around it. You can access them by hitting ALT+CTRL+F1 to F6, the seventh console runs the graphical user interface in which you can switch back with ALT+F7. These virtual consoles come in pretty handy when you have problems with the x-Server or your user account. As long as you can get into the virtual console you can still access your user account. You can even create new user accounts from the terminal or you can copy your data or perform administrative tasks.

The Terminal is also part of some applications, I use the IDE Geany as a text editor for many tasks and part of that is a Terminal. This is useful while scripting, you can work on the script and have the terminal in the same directory as the script for testing. The same function is integrated in gEdit as well as file managers such as Nautilus or Nemo via plugins.
Bildschirmfoto vom 2015-04-01 23:17:22

There are also Terminal applications that offer you the possibility to display several Terminals on one page, which is useful when you have to work on several computers (e.g. servers).

You also get Terminal widgets that integrate into your desktop. Or so called dropdoen Terminals like Guake! (named after the game Quake) or Tilda. Here is my Guake! Terminal
Bildschirmfoto vom 2015-04-01 20:16:49

Having so many Terminals sounds a lot but they all serve a different purpose. I am mainly using the Guake! Terminal cause you can open and hide it with a single key while is is always running in the background. But at times I also use the GNOME Terminal.

But different people have different needs and since it is essential as soon as you want to dive deeper into the system, there are many different Terminal to fit these different needs.

Popular Terminal applications

  1. GNOME Terminal (GNOME based desktops)
  2. Konsole (KDE)
  3. LXTerminal (LXDE)
  4. XfceTerminal (Xfce)
  5. Sakura
  6. Guake!
  7. Yakuake (Yet another Kuake for KDE)
  8. Tilda (recently integrated in UbuntuMATE)

You can find a larger overview on TecMint
http://www.tecmint.com/linux-terminal-emulators/

But before you start changing things, try the one you have. Usually, there is nothing wrong with using the one you have, in particular when you use the Terminal just every once in a while. Just keep in mind that there are others available (even through official repository).

Some basics

The Prompt

When you open up the Terminal you usually end up with something like this
your-user-name@your-computer-name:~$
This is called prompt. The first part is self-explaining, I guess. The tilde indicates that you are in your home directory. When you change the directory, this will change to the directory you are currently in. If you are in the root directory of your system, it will be a slash (/), the tilde is just a shortcut for /home/your-user-name, making the work inside your home directory a lot easier. The dollar sign ($)indicates that you are a normal user, most likely you will never see something else. It would change for root, than it would be a hash (#), but on *buntu you are usually never root. You could actually customize the prompt, but maybe that’s another tutorial.
Bildschirmfoto vom 2015-04-01 20:59:34

Copy&Paste

Copy and paste works in the modern Terminal applications as well, it is just a bit different. You know CTRL+C and CTRL+V, they don’t work in the terminal (CTRL+C is used to terminate commands) but you can use CTRL+SHIFT+C and CTRL+SHIFT+V instead in at least most Terminal applications or use the context menu. So, if you find commands in tutorials you do not have to type them, you can simply copy&paste them.

Autocomplete

Autocomplete is another really nice feature to makes things easier. You just type a part of a command or a path, hit TAB and the command or path gets (partially) completed. If there is more than one option, you can hit TAB twice to get a list of possible options. So in many cases typing two or three characters is enough.

History

The history comes in pretty handy, when you have already typed a command but don’t remember it, you can just enter the command history and the terminal will show you the last entries (but that may be many but in Part 2 of this tutorial, I will tell you, how to use it more comfortable). You can also browse the history using the up and down arrow keys, to modify a command you can use the left and right arrow keys. For example you want to zip two folders, type the zip command once for the first folder and execute it, then hit the up arrow, change the command for the second folder and execute that. you can also change the directory or do other things in the terminal in between, that just means you have to hit the up arrow more often.

Getting help

Linux has a pretty good built-in help system. If you have internet access you might try to google/bing/yahoo/duckduckgo it but often the result isn’t better. Virtually every command has a help function that you can use by typing the command followed by --help. There are also the man pages, that you can open by typing man followed by the command. If the help switch doesn’t provide insight use the man page.

If you want to get an overview on the built-in commands type man builtins or info builtins, happy reading, it’s an awful lot.

Switches/Options

Commands can be modified by using switches or options. One switch was already mentioned the --help. This is the long version of a switch indicated by two times minus, many – but not all switches – also have a short version indicated by one minus. If you need two switches you can combine the short form, so if you have -a and -l you can write -al instead. That is making commands shorter but also worse to read and understand for beginners it’s confusing. Also is doesn’t matter whether it is -al or -la. Switches might also differ in their meaning, so some commands use -h to shorten --help, for other commands -h will have a different meaning. The switches are usually documented in the help or the man page.

Tl;dr

The Terminal is omnipresent on Linux, it’s one of the most basic applications just like a text editor or the file manager. The various Terminal applications are pretty similar in appearance and function and the underlying set of commands available is identical.

In the next part, I will tell you a bit more about the basics and show you the usage of some basic commands..

Leave a comment