Linux Commands Reference
1. File and Directory Commands
ls: Lists directory contents
cd: Changes the current directory
pwd: Displays the current working directory
mkdir: Creates a new directory
rmdir: Removes an empty directory
rm: Deletes files or directories
touch: Creates an empty file
cp: Copies files or directories
mv: Moves or renames files
cat: Displays the contents of a file
find: Searches for files
grep: Searches text using patterns
file: Determines the type of a file
basename: Strips directory and suffix from filenames
dirname: Extracts directory path from filename
stat: Displays file or file system status
tree: Displays directory structure in tree format
locate: Finds files by name using database
updatedb: Updates the database used by locate
2. Disk and Partition Commands
df: Displays disk space usage
du: Displays directory size
mount: Mounts a file system
umount: Unmounts a file system
chmod: Changes file permissions
chown: Changes file ownership
lsblk: Lists information about block devices
blkid: Displays block device attributes
fdisk: Partition table manipulator
mkfs: Creates a file system
tune2fs: Adjust tunable file system parameters
e2label: Sets or gets the label of ext file systems
3. Network Commands
ping: Tests connectivity to another host
ifconfig: Displays network interfaces
ip a: Shows IP addresses of interfaces
netstat: Displays network connections
ss: Displays socket statistics
curl: Transfers data from or to a server
wget: Downloads files from the web
scp: Securely copies files between systems
rsync: Synchronizes files between locations
ssh: Connects to a remote server securely
hostname: Displays or sets system hostname
dig: DNS lookup utility
nslookup: Queries Internet name servers
traceroute: Displays route packets take
telnet: Tests connectivity to a specific port
nmap: Scans network for open ports
4. System and Process Commands
top: Displays real-time system processes
htop: Enhanced interactive process viewer
ps: Displays running processes
kill: Terminates a process by PID
killall: Terminates processes by name
shutdown: Shuts down the system
reboot: Restarts the system
uptime: Shows how long the system has been running
whoami: Displays current logged-in user
id: Displays user ID (UID) and group ID (GID)
free: Displays memory usage
vmstat: Reports virtual memory statistics
iostat: Reports CPU and I/O statistics
dmesg: Displays boot and system messages
uname -a: Displays system information
5. Package Management (Debian-based)
apt update: Updates the package index
apt upgrade: Installs available package upgrades
apt install: Installs a new package
apt remove: Uninstalls a package
apt purge: Removes package with config files
apt autoremove: Removes unnecessary packages
dpkg -i: Installs a .deb package
dpkg -r: Removes a package
dpkg -l: Lists installed packages
6. User Management
adduser: Adds a new user
useradd: Adds a new user (low-level)
passwd: Changes user password
deluser: Deletes a user
usermod: Modifies user account
groupadd: Adds a new group
groups: Shows groups of a user
id: Displays user and group IDs
7. Compression and Archiving
tar: Archives files
gzip: Compresses files
gunzip: Decompresses .gz files
zip: Creates a zip archive
unzip: Extracts a zip archive
xz: Compresses files using xz
unxz: Decompresses xz files
8. Scripting and Permissions
bash: Starts a bash shell
sh: Starts a shell
source: Executes commands from a file
alias: Creates a shortcut for a command
chmod +x: Makes a script executable
which: Shows the path of a command