The terminal and the shell
What the terminal is, how a command is built and how to move between folders.
The terminal is a window where you type text commands. The shell (usually bash or zsh) is the program inside it that reads what you type and runs it. Almost everything on a Linux server is done this way, including over SSH.
The prompt
ana@laptop:~$It shows your user (ana), the machine (laptop) and where you are (~, your home folder). The $ means you are a normal user. A # means you are root, the administrator.
Anatomy of a command
ls -l /var/log
│ │ └── argument: what to act on
│ └── option: changes how it behaves
└── command: what to runWhere am I and what is here?
pwd # print working directory
ls # list files
ls -l # long format: permissions, owner, size, date
ls -la # also show hidden files (names that start with a dot)
cd /var/log # go to an absolute path
cd .. # go up one level
cd ~ # go home
cd - # go back to the previous folderAbsolute and relative paths
- An absolute path starts at the root
/, for example/etc/ssh/sshd_config. It works from anywhere. - A relative path starts from where you are.
.is the current folder and..is the parent. ~is shorthand for your home folder.
Help is built in
ls --help # short summary
man ls # full manual page (press q to quit)NotePress Tab to complete names, and the up arrow to bring back earlier commands. Both save a lot of typing and mistakes.
Test yourself
Answer all the questions, then check them. Finish with every answer right to mark the lesson as done.