Linux Commands
File and Directory Management ls – List files in a directory cd [directory] – Change directory pwd – Print current working directory mkdir [directory] – Create a new directory rmdir [directory] – Remove an empty directory rm [file] – Remove a file rm -r [directory] – Remove a directory and its contents cp [source] [destination] – Copy files or directories mv [source] [destination] – Move or rename files touch [file] – Create a new empty file File Viewing and Editing cat [file] – View file contents nano [file] – Open file in nano text editor vim [file] – Open file in Vim editor head [file] – Display the first 10 lines of a file tail [file] – Display the last 10 lines of a file less [file] – View a file page by page grep "text" [file] – Search for a specific string in a file Permissions and Ownership chmod [permissions] [file] – Change file permissions chown [user]:[group] [file] – Change file owner ls -l – View file permissions Process Management ps aux – List running processes top – Show real-time process usage kill [PID] – Terminate a process kill -9 [PID] – Forcefully terminate a process htop – Interactive process viewer (if installed) System Information whoami – Show current user hostname – Show system hostname uname -a – Show system information df -h – Show disk space usage du -sh [directory] – Show size of a directory uptime – Show how long the system has been running free -h – Show memory usage Networking ping [host] – Check network connectivity ifconfig or ip a – Show IP address and network interfaces netstat -tulnp – Show open network ports curl [URL] – Fetch a URL's content wget [URL] – Download a file User Management who – Show logged-in users id – Show user ID and group ID adduser [username] – Add a new user passwd [username] – Change a user's password su [username] – Switch to another user sudo [command] – Run a command as superuser Package Management Debian/Ubuntu (APT-based) apt update – Update package lists apt upgrade – Upgrade installed packages apt install [package] – Install a package apt remove [package] – Remove a package Red Hat/CentOS (YUM/DNF-based) dnf update – Update system packages dnf install [package] – Install a package dnf remove [package] – Remove a package Arch Linux (Pacman-based) pacman -Syu – Update system packages pacman -S [package] – Install a package pacman -R [package] – Remove a package Disk Management fdisk -l – List available disk partitions mount [device] [directory] – Mount a disk umount [device] – Unmount a disk mkfs.ext4 [device] – Format a partition Logs and Monitoring dmesg – View system boot logs journalctl -xe – View system logs tail -f /var/log/syslog – View real-time system logs Archiving and Compression tar -cvf archive.tar [directory] – Create a tar archive tar -xvf archive.tar – Extract a tar archive gzip [file] – Compress a file gunzip [file.gz] – Decompress a file Other Useful Commands alias ll='ls -lah' – Create a shortcut for a command history – Show command history clear – Clear the terminal screen echo "Hello" – Print text to the terminal date – Show the current date and time shutdown -h now – Shutdown the system

File and Directory Management
ls – List files in a directory
cd [directory] – Change directory
pwd – Print current working directory
mkdir [directory] – Create a new directory
rmdir [directory] – Remove an empty directory
rm [file] – Remove a file
rm -r [directory] – Remove a directory and its contents
cp [source] [destination] – Copy files or directories
mv [source] [destination] – Move or rename files
touch [file] – Create a new empty file
File Viewing and Editing
cat [file] – View file contents
nano [file] – Open file in nano text editor
vim [file] – Open file in Vim editor
head [file] – Display the first 10 lines of a file
tail [file] – Display the last 10 lines of a file
less [file] – View a file page by page
grep "text" [file] – Search for a specific string in a file
Permissions and Ownership
chmod [permissions] [file] – Change file permissions
chown [user]:[group] [file] – Change file owner
ls -l – View file permissions
Process Management
ps aux – List running processes
top – Show real-time process usage
kill [PID] – Terminate a process
kill -9 [PID] – Forcefully terminate a process
htop – Interactive process viewer (if installed)
System Information
whoami – Show current user
hostname – Show system hostname
uname -a – Show system information
df -h – Show disk space usage
du -sh [directory] – Show size of a directory
uptime – Show how long the system has been running
free -h – Show memory usage
Networking
ping [host] – Check network connectivity
ifconfig or ip a – Show IP address and network interfaces
netstat -tulnp – Show open network ports
curl [URL] – Fetch a URL's content
wget [URL] – Download a file
User Management
who – Show logged-in users
id – Show user ID and group ID
adduser [username] – Add a new user
passwd [username] – Change a user's password
su [username] – Switch to another user
sudo [command] – Run a command as superuser
Package Management
Debian/Ubuntu (APT-based)
apt update – Update package lists
apt upgrade – Upgrade installed packages
apt install [package] – Install a package
apt remove [package] – Remove a package
Red Hat/CentOS (YUM/DNF-based)
dnf update – Update system packages
dnf install [package] – Install a package
dnf remove [package] – Remove a package
Arch Linux (Pacman-based)
pacman -Syu – Update system packages
pacman -S [package] – Install a package
pacman -R [package] – Remove a package
Disk Management
fdisk -l – List available disk partitions
mount [device] [directory] – Mount a disk
umount [device] – Unmount a disk
mkfs.ext4 [device] – Format a partition
Logs and Monitoring
dmesg – View system boot logs
journalctl -xe – View system logs
tail -f /var/log/syslog – View real-time system logs
Archiving and Compression
tar -cvf archive.tar [directory] – Create a tar archive
tar -xvf archive.tar – Extract a tar archive
gzip [file] – Compress a file
gunzip [file.gz] – Decompress a file
Other Useful Commands
alias ll='ls -lah' – Create a shortcut for a command
history – Show command history
clear – Clear the terminal screen
echo "Hello" – Print text to the terminal
date – Show the current date and time
shutdown -h now – Shutdown the system