Files & Navigating
ls – Directory listing
ls -l – Formatted listing
ls -la – Formatted listing including hidden files
cd – change to home directory
cd dir (/tmp) – Change current location to new directory
cd .. – Change to parent directory
pwd – Show current directory
mkdir directory name – Create new directory
rm filename – Delete file
rm -f filename – Forced removal of the file
rm -r directory name – remove directory and their contents recursively
rm -rf directory name – remove directory and their contents recursively (forced)
rm -rf / – Never run this command on any system where you care about the data or the integrity of the operating system. It’s effectively a self-destruct command for the system
cp file1 file2 – Copy file1 to file2
mv file1 file2 – Rename file1 to file2
mv file1 dir/file2 – Move file1 to dir as file2
touch – Create or update file
cat file – output contents of file
cat > file – Write standard input into file
cat >> file – Append standard input into file
tail -f file – Output contents of a file as it grows
Networking
ping host – ping computer / server
whois domain – Get WHOIS information from a domain name
dig domain – Get DNS information from a domain name
dig -x host – Reserve lookup host
wget file – Download file
wget -c file – Continue stopped download
wget -r url – Recurively download files from url
curl url – Outputs the webpage from url
curl-o file.html url – Writes the page to file.html
ssh user@host – Connect to host as user
ssh -p port user@host – Connect using port
ssh -D user@host – Connect & use bind port
Processes
ps – display currently active processes
ps aux – detailed outputs
kill pid – kill process with process id (pid)
killall proc – kill all processes named proc
System Info
date – Show current date and time
uptime – Show system uptime
whoami – Logged in as user
w – Display who is online
cat /proc/cpuinfo – Display CPU info
cat /proc/meminfo – Display memory info
free – Show memory and swap usage
du – Show directory usage
du -sh – Display readable sizes in GB
df – Show disk usage
uname -a – Show kernel config