The shell is a program that takes commands you type on the keyboard and gives them to the operating system to run. In Linux, the most common shell is bash, which stands for “Bourne Again SHell”, a reference to the fact that bash is an enhanced replacement for sh, the original Unix shell program written by Steve Bourne.
Terminal Emulators
When you use a graphical interface (like on your computer desktop), you need a program called a terminal emulator to access the shell. Programs like konsole for KDE or gnome-terminal for GNOME are examples of these. They all do the same thing: they let you type commands for the shell.
Making Your First Keystrokes
When you open a terminal emulator, you will see a shell prompt, which looks something like [me@linuxbox ~]$. This prompt tells you that the shell is ready for a command.
The prompt usually shows your username, the machine name, and the current working directory.
- If the prompt ends with a dollar sign (
$), you have a regular user session. - If it ends with a pound sign (
#), you have superuser privileges, which means you have special administrative powers.
If you type a command that doesn’t exist, the shell will tell you “command not found”.
Useful Keyboard and Mouse Features
- Command History: You can use the up-arrow key to see previous commands you’ve typed. This is called command history. The down-arrow key lets you go back to the current prompt.
- Cursor Movement: The left and right arrow keys let you move the cursor anywhere on the command line to easily edit your commands.
- Mouse Copy/Paste: You can quickly copy text by highlighting it with the left mouse button. To paste, you press the middle mouse button. This is a feature of the X Window System that powers the graphical desktop. Be careful not to use
Ctrl-candCtrl-vinside the terminal, as these shortcuts have different functions there.
Simple Commands
Here are some basic commands you can try:
date: Shows the current date and time.uptime: Shows how long the system has been running and other information like the number of users.df: Shows the amount of free space on your disk drives.free: Shows the amount of free memory (RAM).
Ending a Terminal Session
You can close a terminal session in a few ways:
- Closing the terminal window.
- Typing the
exitcommand. - Pressing
Ctrl-don your keyboard.
Virtual Consoles
Even without a terminal emulator running, there are multiple terminal sessions running in the background. These are called virtual terminals or virtual consoles. You can access them by pressing Ctrl-Alt-F1 to Ctrl-Alt-F6. You will see a login screen where you can enter your username and password. To return to your graphical desktop, press Alt-F7.