The Shell - Your Command Center
The shell is a program that reads the commands you type and asks the kernel to run them. The most common shell is bash (Bourne Again SHell).
Analogy: The shell is a conversation. You type a request, press Enter, the system does it and replies. That little bit of text waiting for you is the prompt.
Read a typical prompt left to right:
labuser@shellgenius:~$
│ │ │ └ $ = normal user (# would mean root/admin)
│ │ └ ~ = current directory (~ means your home)
│ └ hostname (which machine)
└ username (who you are)
Every command follows the same grammar:
command -options arguments
ls -l -a /etc
- command - what to do (
ls) - options / flags - how to do it (
-llong,-aall). Short flags combine:-la. - arguments - what to do it to (
/etc)
$ whoami
labuser
$ ls -la /etc | head -3
total 1240
drwxr-xr-x 1 root root 4096 Jan 1 10:00 .
drwxr-xr-x 1 root root 4096 Jan 1 10:00 ..
Tip: Press Tab to auto-complete commands and paths - it saves typing and prevents typos. Press the Up arrow to recall your last command.
Try whoami, hostname, and ls -la in the terminal below.