Linux Commands Cheatsheet

Linux Commands Cheatsheet

Essential Linux commands for system administration and DevOps.

File System Navigation

# List files and directories
ls
ls -la

# Change directory
cd <directory>

# Print working directory
pwd

# Create directory
mkdir <directory>

# Remove file
rm <file>

# Remove directory
rm -rf <directory>

# Copy file
cp <source> <destination>

# Move/rename file
mv <source> <destination>

File Viewing and Editing

# View file content
cat <file>

# View file with pagination
less <file>

# View first few lines
head <file>

# View last few lines
tail <file>

# Edit file
nano <file>
vim <file>

System Information

# Display system information
uname -a

# Display disk usage
df -h

# Display memory usage
free -h

# Display running processes
ps aux

# Display system uptime
uptime

User Management

# Add user
sudo adduser <username>

# Change password
sudo passwd <username>

# Switch user
su <username>

# Run command as superuser
sudo <command>