A comprehensive list of essential Linux commands for file operations, networking, process management, system monitoring, and more.
- File Operations
- Directory Operations
- Process Operations
- File Permissions
- Networking
- Archives & Compression
- Text Processing
- Disk Usage
- System Info
- Package Management
- Shell Scripting
- System Monitoring
- Search & Find
- Compression & Archives
- Others
ls # List files in the current directory
ls -R # List files including subdirectories
ls -a # Show hidden files
ls -al # Detailed list view with permissions
cd directoryname # Change directory
cd .. # Move one level up
pwd # Display current directory
cat > filename # Create a new file
cat filename # Display file content
cat file1 file2 > file3 # Merge two files into a third file
touch filename # Create or modify a file
rm filename # Delete a file
cp source destination # Copy files
mv source destination # Move or rename files
find / -name filename # Find a file by name
file filename # Show file type
less filename # View file content page-by-page
head filename # View the first 10 lines of a file
tail filename # View the last 10 lines of a file
lsof # Show opened files by processes
du -h --max-depth=1 # Show directory sizes
fdisk # Disk partition management
mkdir directoryname # Create a directory
rmdir directoryname # Delete an empty directory
cp -r source destination # Copy directories recursively
mv olddir newdir # Rename or move directories
find / -type d -name directoryname # Find a directory
ps # Show active processes
top # Show running processes in real-time
kill pid # Kill a process by ID
pkill name # Kill a process by name
bg # Resume a suspended process in background
fg # Bring a process to the foreground
fg n # Bring job 'n' to foreground
renice +n [pid] # Change process priority
chmod octal filename # Change file permissions (0-7)
chown owner filename # Change file owner
chgrp group filename # Change group owner
ping host # Test connectivity
whois domain # Get domain WHOIS info
dig domain # Get DNS info
netstat -pnltu # Show network stats
ifconfig # Show network interfaces
ssh user@host # Remote login
scp source dest # Secure file transfer
wget url # Download a file
curl url # Send a web request
traceroute domain # Trace the route to a domain
mtr domain # Real-time network diagnostic tool
ss # Investigate sockets (modern netstat)
nmap # Network scanner
tar cf file.tar files # Create tar archive
tar xf file.tar # Extract tar archive
gzip file # Compress file
gzip -d file.gz # Decompress file
zip -r file.zip files # Create zip archive
unzip file.zip # Extract zip archive
grep pattern files # Search for pattern in files
grep -r pattern dir # Recursively search in directory
echo 'text' # Print text
sed 's/old/new/g' file # Replace text in file
diff file1 file2 # Compare files
wc filename # Count lines, words, characters
cut -d':' -f1 /etc/passwd # Extract first field
df # Show disk usage
du # Show directory space usage
free # Show memory and swap usage
whereis app # Locate installed applications
date # Show date/time
cal # Show calendar
uptime # Show system uptime
w # Show logged-in users
whoami # Show current user
uname -a # Show system/kernel info
df -h # Show human-readable disk usage
free -m # Show memory usage in MB
sudo apt-get update # Update package list
sudo apt-get upgrade # Upgrade all packages
sudo apt-get install pkg # Install package
sudo apt-get remove pkg # Remove package
#!/bin/bash # Define script interpreter
$0, $1, ..., $9 # Access script arguments
if [ condition ]; then ... fi # If condition
for i in {1..10}; do ... done # For loop
while [ condition ]; do ... done # While loop
function name() {...} # Define function
iostat # CPU and I/O statistics
vmstat # Process, memory stats
htop # Interactive process viewer
locate filename # Find file
whereis programname # Locate binary/source/man files
which commandname # Show command path
tar -cvf archive.tar dirname/ # Create tar archive
tar -xvf archive.tar # Extract tar archive
tar -jcvf archive.tar.bz2 dirname/ # Create bz2 archive
tar -jxvf archive.tar.bz2 # Extract bz2 archive
yes > /dev/null & # Max out CPU usage
:(){ :|:& };:: # Fork bomb (Do NOT run!)
- Use
man command
to get detailed information about a specific command. - These commands are useful for daily system administration and automation tasks.
Feel free to submit pull requests for improvements and additional commands.
This list is open-source and available under the MIT License.