Most Important Linux Commands for Beginners in Cloud & DevOps
A compact, practical list of essential Linux commands covering file & disk management, users & groups, text tools, networking, monitoring, AWS CLI, Docker, and more.
1. File and Disk Management
ls → List files and directories in the current folder
ls -l → List files with details (permissions, ownership, size, date)
ls -a → Show all files including hidden ones
cat -b → Add line numbers to non-blank lines
cat -n → Add line numbers to all lines
cat -s → Remove extra blank lines
cat -E → Display $ at the end of each line
chmod → Change permissions
chown → Change ownership
dd → Copy data between devices
tail → Show last lines of a file
find → Search for files
scp → Securely copy files between servers
df → Show disk usage
du → Show directory size
htop → Interactive resource monitor
ps → Show running processes
kill → Terminate a process
history → Show command history
free → Display memory usage
2. User and Group Management
sudo useradd <username> → Create a new user
sudo passwd <username> → Change a user password
sudo userdel <username> → Delete a user account
sudo groupadd <groupname> → Create a new group
sudo groupdel <groupname> → Delete a group
sudo usermod -g <groupname> <username> → Assign user to a new group
id → Show UID, GID, and groups
id -u <username> → Show user ID
id -g <groupname> → Show group ID
3. Text Manipulation and Filtering
sort -r → Sort lines in reverse order
sort -f → Sort lines ignoring case
sort -n → Sort lines numerically
cut → Extract specific fields
diff → Compare two files
tr → Translate or delete characters
sed → Replace text in files
uniq → Remove duplicate lines
4. System Information
uname -o → Show OS name
uname -m → Show machine architecture
uname -r → Show kernel version
lscpu → Display CPU information
whoami → Show current username
5. Package Management (Ubuntu/Debian)
apt-get update → Update package list
apt-get install <package> → Install package
sudo apt-get remove <package> → Remove package
6. Network Configuration and Monitoring
ifconfig → Show network configuration
ifconfig -a → Show all interfaces
ip address → Display IP addresses
ip link → Show network interfaces
nslookup <domain> → DNS query
route → Show routing table
iptables → Manage firewall rules
lsof → List open files
lsof -u <username> → List files opened by a user
netstat → Show network connections
ssh-keygen → Generate SSH keys
telnet <host> → Test remote connectivity
nmap <host> → Scan open ports
curl <url> → Transfer data from or to a URL
7. System Monitoring
top → Real-time process monitor
htop → Interactive process viewer
vmstat → Display performance stats
iostat → Show CPU and I/O usage
uptime → Show system running time
8. Text Searching with Grep
grep -i <pattern> <file> → Case-insensitive search
grep -n <pattern> <file> → Show line numbers of matches
grep -v <pattern> <file> → Show lines not matching pattern
grep -c <pattern> <file> → Count number of matches
9. AWS CLI Commands
Setup and Identity
aws configure → Configure access keys and region
aws sts get-caller-identity → Verify identity and permissions
S3 (Storage)
aws s3 ls → List all S3 buckets
aws s3 mb s3://<bucket-name> → Create a new bucket
aws s3 cp file.txt s3://<bucket-name>/ → Upload file to S3
aws s3 sync ./localdir s3://<bucket-name>/ → Sync folder to S3
aws s3 rm s3://<bucket-name>/file.txt → Delete file from S3
EC2 (Compute)
aws ec2 describe-instances → List EC2 instances
aws ec2 start-instances --instance-ids <id> → Start instance
aws ec2 stop-instances --instance-ids <id> → Stop instance
aws ec2 terminate-instances --instance-ids <id> → Terminate instance
aws ec2 run-instances --image-id <ami> --instance-type t2.micro → Launch new instance
aws ec2 describe-instance-status → Check instance health
aws ec2 describe-addresses → View public IPs
IAM (Identity and Access)
aws iam list-users → List IAM users
aws iam create-user --user-name <name> → Create IAM user
aws iam attach-user-policy --user-name <name> --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess → Attach policy to user
aws iam create-access-key --user-name <name> → Create access keys
CloudWatch & Monitoring
aws cloudwatch list-metrics → List all CloudWatch metrics
aws cloudwatch get-metric-statistics --metric-name CPUUtilization → View CPU metrics for EC2
aws cloudtrail lookup-events → View user activity logs
Automation
aws ec2 describe-instances --query "Reservations[].Instances[].InstanceId" --output text → Extract instance IDs
aws ec2 stop-instances --instance-ids $(aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" --query "Reservations[].Instances[].InstanceId" --output text) → Stop all running EC2s
10. Docker and Container Management
docker ps → List active containers
docker images → List Docker images
docker build → Build image from Dockerfile
docker run → Run a container
docker stop <container_id> → Stop running container
docker-compose up → Start multi-container services
docker-compose down → Stop and remove containers
11. Miscellaneous Utilities
getent → Query user, group, or DNS databases
sort → Sort text lines
uniq → Remove duplicate lines
cut → Extract text portions
tr → Replace or delete characters
