This is your essential reference for Linux terminal commands. Fifty commands, organized by category, each with a brief explanation and a practical example. Bookmark this page and come back whenever you need a reminder.
If you are completely new to the terminal, start with our introduction to the Linux terminal first, then return here for a broader reference.
Navigation commands
These five commands are the foundation — you will use them every single time you open a terminal.
1. pwd — Show current directory
pwd
# Output: /home/alice/Documents
2. ls — List directory contents
ls # basic listing
ls -l # detailed listing with sizes and dates
ls -la # include hidden files
ls -lh # human-readable file sizes (KB, MB, GB)
ls /etc # list a specific directory
3. cd — Change directory
cd Documents # go into Documents folder
cd .. # go up one level
cd ../.. # go up two levels
cd ~ # go to your home directory
cd /var/log # go to an absolute path
cd - # go back to the previous directory
4. tree — Display directory structure
tree # show tree of current directory
tree -L 2 # limit depth to 2 levels
5. find — Search for files
find . -name "*.txt" # find all .txt files in current directory
find /home -name "report*" # find files starting with "report"
find . -type d # find directories only
find . -mtime -7 # files modified in the last 7 days
File and directory management
6. mkdir — Create a directory
mkdir projects
mkdir -p projects/web/css # create nested directories at once
7. touch — Create an empty file or update timestamp
touch notes.txt
touch file1.txt file2.txt file3.txt # create multiple files
8. cp — Copy files or directories
cp file.txt backup.txt # copy a file
cp file.txt /home/alice/Documents/ # copy to another directory
cp -r myfolder/ backup-folder/ # copy a directory recursively
9. mv — Move or rename files
mv oldname.txt newname.txt # rename a file
mv file.txt /tmp/ # move file to /tmp
mv folder/ /home/alice/backup/ # move a directory
10. rm — Remove files or directories
rm file.txt # delete a file
rm -i file.txt # ask for confirmation before deleting
rm -r folder/ # delete a directory and its contents
rm -rf folder/ # force delete without confirmation (use with care)
11. ln — Create links
ln -s /path/to/file shortcut # create a symbolic link
12. du — Show disk usage of files and directories
du -sh Documents/ # total size of Documents folder
du -sh * # size of all items in current directory
13. df — Show disk space usage
df -h # disk usage of all mounted filesystems
File viewing and editing
14. cat — Display file contents
cat file.txt
cat file1.txt file2.txt # display multiple files
15. less — View large files one page at a time
less /var/log/syslog
Inside less: use arrow keys to scroll, q to quit, / to search.
16. head — Show the first lines of a file
head file.txt # first 10 lines (default)
head -n 20 file.txt # first 20 lines
17. tail — Show the last lines of a file
tail file.txt # last 10 lines
tail -n 50 file.txt # last 50 lines
tail -f /var/log/syslog # follow the file in real time (great for logs)
18. nano — Simple text editor in the terminal
nano file.txt
Ctrl+O saves, Ctrl+X exits.
19. wc — Count lines, words, characters
wc file.txt # lines, words, characters
wc -l file.txt # count lines only
20. diff — Compare two files
diff file1.txt file2.txt
System information
21. uname — Show system information
uname -a # full system information
uname -r # kernel version only
22. hostname — Show or set system hostname
hostname # show hostname
hostname -I # show local IP address
23. uptime — Show how long the system has been running
uptime
24. whoami — Show the current user
whoami
25. date — Show or set the system date and time
date
date "+%Y-%m-%d" # formatted output: 2026-02-05
26. free — Show memory usage
free -h # human-readable memory usage (RAM and swap)
27. lscpu — Show CPU information
lscpu
Process management
28. ps — Show running processes
ps aux # all processes with details
ps aux | grep firefox # find a specific process
29. top — Real-time process monitor
top
Press q to exit, k to kill a process by PID.
30. htop — Better interactive process monitor (install separately)
sudo apt install htop
htop
31. kill — Send a signal to a process
kill 1234 # gracefully stop process with PID 1234
kill -9 1234 # force kill (last resort)
32. killall — Kill all processes with a given name
killall firefox
33. bg and fg — Background and foreground jobs
command & # run a command in the background
bg # send current job to background
fg # bring background job to foreground
User management
34. sudo — Run a command as administrator
sudo apt update
sudo nano /etc/hosts
35. su — Switch user
su alice # switch to user alice
36. adduser — Add a new user
sudo adduser bob
37. passwd — Change a user’s password
passwd # change your own password
sudo passwd bob # change another user's password
38. groups — Show group memberships
groups # your groups
groups alice # alice's groups
Network commands
39. ping — Test connectivity to a host
ping google.com # continuous ping (Ctrl+C to stop)
ping -c 4 google.com # send exactly 4 packets
40. curl — Transfer data from URLs
curl https://example.com # download a page
curl -I https://example.com # show HTTP headers only
curl -o file.zip https://example.com/file.zip # download to a file
41. wget — Download files from the internet
wget https://example.com/file.zip
wget -q https://example.com/file.zip # quiet mode
42. ip — Show and configure network interfaces
ip addr show # all interfaces and IP addresses
ip route show # routing table
43. ss — Show network connections and sockets
ss -tuln # listening TCP and UDP ports
44. ssh — Connect to a remote server
ssh user@192.168.1.100
ssh -p 2222 user@server.com # use custom port
Package management
45. apt — Package manager for Ubuntu/Debian
sudo apt update # update package list
sudo apt upgrade # upgrade all packages
sudo apt install vlc # install a package
sudo apt remove vlc # remove a package
sudo apt search music # search for packages
apt list --installed # list installed packages
46. dpkg — Low-level package tool (Debian/Ubuntu)
sudo dpkg -i package.deb # install a .deb file
dpkg -l # list installed packages
File permissions
47. chmod — Change file permissions
chmod 755 script.sh # owner: rwx, group: r-x, others: r-x
chmod +x script.sh # make a file executable
chmod -R 644 folder/ # change permissions recursively
48. chown — Change file ownership
sudo chown alice file.txt # change owner
sudo chown alice:developers file.txt # change owner and group
sudo chown -R www-data /var/www/ # change ownership recursively
Text processing
49. grep — Search for text patterns
grep "error" logfile.txt # find lines containing "error"
grep -i "linux" file.txt # case-insensitive search
grep -r "TODO" /home/alice/projects/ # search recursively in directory
grep -n "error" logfile.txt # show line numbers
grep -v "debug" logfile.txt # show lines NOT matching
50. sort, uniq, cut — Text manipulation tools
sort names.txt # sort lines alphabetically
sort -r names.txt # reverse sort
sort -n numbers.txt # sort numerically
sort names.txt | uniq # remove duplicate lines
cat file.txt | cut -d',' -f1 # extract the first column (comma-separated)
Tips to learn faster
Learning fifty commands takes time, but there are ways to make it stick.
Use them every day: Open a terminal and navigate your file system using cd and ls instead of the graphical file manager. Do this for a week and these commands become automatic.
Build on what you know: Start with navigation (commands 1-5). Once those feel natural, add file management (6-13). Progress through the categories at your own pace.
Use the history: Press the Up arrow to recall previous commands. Linux keeps a history of your last 1000 or more commands. Use history to see them and !123 to run command number 123 again.
Tab completion: Press Tab to auto-complete file names and directory paths. Type cd Doc and press Tab — it completes to cd Documents. This prevents typos and saves time.
Combine commands with pipes: The pipe character | sends the output of one command into another. ls -la | grep .txt lists all files then filters only the ones containing “.txt”. This is how simple commands become powerful tools.
Read the manual: When you want to know more about a command, run man commandname. All fifty commands above have manual pages with detailed documentation.
For the next step, read about understanding the Linux file system to understand where files live and why, and Linux file permissions explained to master the permissions system you control with chmod and chown.