← Back to all blog posts
Jump to article
Linux article

Linux Commands Cheat Sheet (with a Free Terminal to Try Them)

The everyday Linux commands, grouped by job - and a real terminal to run them in.

Linux Commands Cheat Sheet (with a Free Terminal to Try Them)

This is a practical Linux command cheat sheet: the commands you actually use day to day, grouped by what you are trying to do. Every command here is taught - and can be run - in our free Learn Linux course. Want to try one right now? Open the free online Linux terminal (a real Linux machine in your browser) and type along.

Navigating the file system

  • pwd - print the directory you are in
  • ls -la - list files, including hidden ones, in long format
  • cd /path - change directory; cd .. goes up, cd ~ goes home
  • find . -name "*.log" - find files by name
  • tree - show the directory tree

Learn these properly in Where am I? pwd and ls and Finding files with find.

Working with files

  • cat file / less file - show a file; head / tail show the start/end
  • cp a b, mv a b, rm file - copy, move/rename, delete
  • mkdir dir, touch file - make a directory or an empty file
  • nano file / vim file - edit a file in the terminal

Permissions and ownership

  • chmod 755 script.sh - set permissions by number (what 644/755/600 mean)
  • chmod +x script.sh - make a file executable
  • chown user:group file - change owner and group
  • ls -l file - read a file's permissions

Text and logs

  • grep "error" file - find lines matching a pattern (grep lesson)
  • cut, sort, uniq - pull out columns, sort, de-duplicate
  • sed 's/old/new/g' file - find and replace
  • awk '{print $1}' file - print a column (awk lesson)
  • cmd1 | cmd2 - pipe one command's output into another

Processes and the system

  • ps aux, pgrep name - list / find processes
  • top - watch processes live
  • kill PID, kill -9 PID - stop a process
  • df -h, du -sh * - disk space free / used
  • systemctl status name - check a service

Packages and networking

  • apt update && apt install pkg - install software (Debian/Ubuntu)
  • ip a, ss -tln - show addresses / listening ports
  • curl -I http://host - fetch HTTP headers
  • ping host, dig name - test connectivity / resolve a name

The fastest way to learn these

Reading a cheat sheet is a start, but Linux sticks when you type the commands. Open the online Linux terminal and try them, or follow the free, step-by-step Learn Linux course where every lesson has a hands-on lab on a real Linux machine in your browser.

HOME LABS COMMUNITY DASHBOARD