Linux Commands
Essential Linux/Unix commands for system administration.
File Operations
ls -laList all files with details
cd <directory>Change directory
pwdPrint working directory
cp <source> <dest>Copy file or directory
cp -r <source> <dest>Copy directory recursively
mv <source> <dest>Move or rename file
rm <file>Remove file
rm -rf <directory>Remove directory recursively
mkdir <directory>Create directory
touch <file>Create empty file
cat <file>Display file contents
less <file>View file with pagination
head <file>Show first 10 lines
tail <file>Show last 10 lines
tail -f <file>Follow file updates
File Permissions
chmod 755 <file>Change file permissions
chmod +x <file>Make file executable
chown user:group <file>Change file owner
chown -R user:group <dir>Change owner recursively
Process Management
ps auxList all running processes
topDisplay processes in real-time
htopInteractive process viewer
kill <pid>Kill process by ID
kill -9 <pid>Force kill process
killall <name>Kill all processes by name
bgResume job in background
fgBring job to foreground
jobsList background jobs
System Information
uname -aShow system information
df -hShow disk usage
du -sh <directory>Show directory size
free -hShow memory usage
uptimeShow system uptime
whoamiShow current user
hostnameShow system hostname
Network
ping <host>Test network connectivity
curl <url>Transfer data from URL
wget <url>Download file from URL
netstat -tulnShow listening ports
ss -tulnShow socket statistics
ip addrShow IP addresses
ifconfigShow network interfaces
Search & Find
find . -name "*.txt"Find files by name
grep "pattern" <file>Search text in file
grep -r "pattern" <dir>Search recursively
locate <file>Find file by name (fast)
which <command>Show command location
Archive & Compression
tar -czf archive.tar.gz <dir>Create compressed archive
tar -xzf archive.tar.gzExtract compressed archive
zip -r archive.zip <dir>Create zip archive
unzip archive.zipExtract zip archive
gzip <file>Compress file
gunzip <file.gz>Decompress file
User Management
sudo <command>Run command as superuser
su - <user>Switch user
useradd <user>Create new user
passwd <user>Change user password
usermod -aG <group> <user>Add user to group