Every command from the topic in one table: from the basics (where am I) to services, networking and scripts. Read top to bottom and try each command in your practice folder.
Command cheat sheet: from basics to advanced
| Command | What it does |
|---|---|
pwd | Shows which directory you are in |
ls -la | Lists files, including hidden ones, with permissions and owner |
cd ~/linux-practice | Changes directory; plain cd returns home |
whoami / id | Current user and their groups |
uname -r | Linux kernel version |
cat /etc/os-release | Distribution name and version |
ls --help / man ls | Short help / full manual for a command (q to quit) |
mkdir -p a/b | Creates a directory including parent folders |
touch notes.txt | Creates an empty file |
cp a b / cp -r dir backup/ | Copies a file / a whole directory |
mv old new | Moves or renames |
rm -i file | Deletes with confirmation; there is no recycle bin |
cat / less file | Prints a file / pages through a long file |
nano file | Simple editor: Ctrl+O save, Ctrl+X exit |
grep word file | Finds lines containing a word |
echo text > f / >> f | > replaces file content, >> appends |
cmd1 | cmd2 | Passes one command's output to another |
chmod 640 file | Permissions: owner rw, group r, others none |
chmod u+x script.sh | Gives the owner execute permission |
sudo command | Runs with admin rights — only when needed |
sudo apt update | Refreshes the package list |
sudo apt upgrade | Upgrades installed packages |
sudo apt install pkg | Installs a package |
ps aux / top | Process list / live monitor (q to quit) |
kill PID | Asks a process to stop by its ID |
systemctl status ssh | Service state: running or not, recent errors |
sudo systemctl start / enable ssh | start — run now; enable — at boot |
journalctl -u ssh | Event log of a service |
ip a | IP addresses of interfaces |
ip route | Routing table and default gateway |
ping -c 4 8.8.8.8 | Connectivity test: 4 requests |
ss -tulpn | Which ports are open and who listens |
ssh user@host | Remote login to another machine |
./hello.sh | Runs a script from the current directory |