An introduction to the Linux command line terminology

Linux command line terminology – 2.3

What’s a shell? Or a command prompt? An introduction to the Linux command line and shell, intended for Linux newbies who know absolutely nothing about the command line. Learn what is the command line and shell, how to get started with the command line, and what are virtual terminals and terminal emulators.

The Linux command line >

As you probably know, there are two kinds of user interfaces out there: graphical user interfaces (GUI’s) and command line interfaces (CLI’s). You probably know that in a GUI you control things by pointing and clicking with your mouse, and in a CLI you type commands with your keyboard.

For example, the ye olde MS-DOS has a command line interface. In the old days the command line was the only interface available on Unix systems, but these days Unix and Linux systems have a graphical user interface, too. Probably you find the GUI easier to learn, at least if you’ve accustomed to the interface of the most popular OS, Microsoft Windows.

Because the Linux command line looks very much like MS-DOS, some people confuse them and think the Linux CLI is just like DOS. Don’t get these mixed! Keep in mind that the Linux CLI is much more powerful than DOS. DOS sucks big time when compared to the Linux CLI!

 

The shell program >

Now we can finally start talking about the shell. You see, when you mess around in the Linux command line, there’s always a program called shell running. The shell is the program that interacts between you and the operating system. When you type commands, it’s the shell that reads the commands from your keyboard, processes them, and finally gives them to the operating system. There are many different shell programs out there, but on most Linux systems, bash (Bourne Again SHell) is the default shell. So, when you start a shell on your Linux system, it’s most likely bash.

If you’re in the X Window System (the GUI) right now, and want to start playing with the CLI, you have two ways of doing so. You can switch to another virtual terminal or start a terminal emulator.

 

Terminal emulators >

terminal emulator is a program that opens up a window and then runs a shell in that window. It could be compared to the DOS shell in Windows. You start a terminal emulator like any other X program, so it means that you can have a command line while you’re still safely in the GUI! There are a bunch of different terminal emulators out there, like xterm, rxvt, gnome-terminal, konsole, kvt, eterm, and many many others.

Now go ahead and browse the programs menu that you normally use for launching programs, and look for apps that seem like a terminal emulator. You can launch as many of them as you want and try all of them. It doesn’t matter which one you use because basically all of them do the same thing: let you use the shell. Different terminal emulators have different bells and whistles, but you run the same shell program, bash, in each of them.

 

Virtual terminals >

Another way of getting to the CLI is to leave the GUI completely. You could do this by shutting down the X Window System, but you probably don’t want to do that. Instead, you can just switch to another virtual terminal, while the X Window System is still running. By default, Linux usually has six virtual terminals and the seventh one is where X is running. Pressing Ctrl+Alt+F1 takes you to the first virtual terminal, Ctrl+Alt+F2 takes you to the second virtual terminal, and so on. So, you can switch the virtual terminals by pressing Ctrl, Alt and the function key with the number of the desired terminal.

When you’re in the virtual terminals, you’re not in the GUI (X Window System) anymore, you’re only in the CLI. But although you’re not in X anymore, you didn’t shut it down. It’s still happily running in the seventh virtual terminal, so you can just switch back there normally with Ctrl+Alt+F7.

You probably see a login: prompt in the virtual terminals. However, instead of the login: prompt, you might also see weird text filling the whole screen. Don’t worry, the weird text is just the messages that X is displaying. This is normal and you shouldn’t worry about it. Just switch to another virtual terminal and everything’s cool again.

When the terminal displays the login: prompt, you can just type in your user name and log in normally in the terminal. After logging in you’ll get the same bash shell. Now go ahead and try out the virtual terminals if you want, but don’t forget to come back with Ctrl+Alt+F7.

 

The command prompt >

It’s finally time to check out the command prompt. You can log in to one of the virtual terminals or go to X and launch a terminal emulator. Maybe doing things in X with a terminal emulator would be easier at first, but basically it doesn’t matter because the result is the same: you have a bash prompt in front of you.

Now let’s have a look at the prompt. Usually the prompt consists of your user name and machine name, followed by some symbol, usually $ or >. You should NOT see a # because that’s how the prompt usually ends if you’re logged in as root, and you should NOT be logged in as root when doing experiments like the one we’re doing right now! It’s DANGEROUS because you have the permissions to do anything! You should do your daily work as a NORMAL user! You’ve been warned!

Ok, back to the topic. The prompt looks something like this:
me@puter: ~$

It shows the user name (me), machine name (puter) and the $ symbol indicates that I’ve logged in as a normal user. Great… now what?

The prompt is waiting for you to type a command or a name of a program. Actually these are the same thing because all the commands in Linux are little programs themselves, and you run the programs by typing their name. For example, try typing ls now. As you can see from the output, the command ls lists the contents of your current directory. So, ls is a little program that likes listing the contents of directories.

Scroll to Top