Basic Commands
Quick Linux shell commands. Deep refs: netstat (ss/netstat/ps) ยท Linux Tools
๐ Processes โ ps
ps # Your shell's processes
ps aux # All processes (user, PID, CPU, command)
ps -ef # Full format listing
ps aux | grep apache
ps aux --forest # Process treePair with netstat โ find listener PID with ss -nltp, then ps aux | grep PID.
Port already in use on Kali? โ Port in Use - kill listener
Symlinks / privesc โ ln - symlinks
Script first line โ Shebangs
Preview file start โ head (head -n 200 file.txt)
๐ Navigation & files
ls -la
cd /path
pwd
fg # Foreground a background job๐ Archives โ tar
Full zip/7z/unzip/zipinfo reference โ Archives - unzip 7z zip ยท apt/deb/download โ Install Download and Run
tar -xvf file.tar # Extract .tar โ **[[tar]]**
tar -xzvf file.tar.gz # Extract .tar.gz (gzip โ note -z)
tar -xjvf file.tar.bz2 # Extract .tar.bz2 (bzip2 โ note -j)
tar -tzf file.tar.gz # List contents without extract| Flag | Meaning |
|---|---|
-x | Extract |
-v | Verbose |
-f | File |
-z | gzip |
-j | bzip2 |