1. Understand your terminal
whoami pwd date hostname
whoamishows the current username.pwdprints the present working directory.datedisplays the system date and time.hostnamedisplays the machine's hostname.
2. List and navigate directories
ls ls -l ls -la cd /var/log pwd cd ~ cd ..
ls lists files; -l shows detailed information; -a includes hidden entries. cd changes the current directory.
3. Create files and directories
mkdir practice cd practice touch notes.txt ls -l cat notes.txt echo "My Linux practice" > notes.txt cat notes.txt
mkdir creates a directory, touch creates an empty file when it does not exist, and cat displays file contents. The > operator replaces the file's existing contents, so use it carefully.
4. Copy, move and remove
cp notes.txt notes-backup.txt mv notes-backup.txt revised-notes.txt ls -l mkdir archive mv revised-notes.txt archive/ ls archive
Practise these commands only inside your own practice directory. Use rm carefully because deleting files may be irreversible.
5. Processes
ps ps aux top
ps displays process information. ps aux shows a broader process listing, and top provides a live process view; press q to quit.
Revision Questions
- What is the difference between
pwdandls? - How do you list hidden files?
- How can you create an empty file?
- What information does
psshow?