Here are the top 40 Linux commands used by DevOps engineers, categorized from beginner to advanced:
๐ Beginner Level:
ls - List files and directories.
cd - Change directory.
pwd - Print the current working directory.
mkdir - Create a new directory.
rm - Remove files and directories.
cp - Copy files and directories.
mv - Move or rename files and directories.
touch - Create an empty file.
cat - View the contents of a file.
grep - Search for patterns in files.
chmod - Change file permissions.
chown - Change file ownership.
tar - Create or extract tar archives.
find - Search for files and directories.
top - Monitor system processes.
๐ Intermediate Level:
ssh - Connect to remote servers securely.
scp - Securely copy files between local and remote systems.
rsync - Synchronize files and directories between systems.
curl - Transfer data to or from a network server.
wget - Download files from the web.
sed - Stream editor for text manipulation.
awk - Text processing and pattern matching.
diff - Compare files line by line.
git - Version control system.
svn - Subversion version control system.
tar - Compress and extract files.
gzip - Compress files using gzip algorithm.
unzip - Extract files from ZIP archives.
crontab - Schedule periodic tasks.
systemctl - Control system services.
๐ Advanced Level:
iptables - Configure firewall rules.
netstat - Network statistics and connections.
ping - Send ICMP echo requests to a network host.
ifconfig - Configure network interfaces.
route - View and manipulate the IP routing table.
dig - DNS lookup utility.
nc - Network utility for reading/writing to network connections.
lsof - List open files and associated processes.
strace - Trace system calls and signals.
docker - Containerization platform for building, deploying, and managing applications.
These commands cover a wide range of tasks and are commonly used by DevOps engineers in their day-to-day activities.
๐ค Exercise for Fun
Task: What is the Linux command to
To view what's written in a file.
cat file_name Ex: cat file.txt
To change the access permissions of files.
chmod permission file_name Ex- chmod 777 file.txt
To check which commands you have run till now.
history
To remove a directory/ Folder.
rm -r directoy/folder Ex: rm -r deamon
To create a fruits.txt file and to view the content.
vim file_name # create file with contents cat file_name # view content of file Ex: vim fruits.txt cat fruits.txt
Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
echo -e "text\n" >> file_name Ex: echo -e "Cherry\nKiwi\nOrange\nGuvava" >> fruits.txt
Show only the top three fruits from the file.
head -n lines file_name Ex: head -n 3 fruits.txt
Show only the bottom three fruits from the file.
tail -n lines file_name Ex: tail -n 3 fruits.txt
To create another file Colors.txt and to view the content.
vim file_name # create file with contents cat file_name # view content of file Ex: vim colors.txt cat colors.txt
Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.
echo -e "text\n" >> file_name Ex: echo -e "Red\nPink\nWhite\nBlack\nBlue\nOrange\nPurple\nGrey" >> colors.txt
To find the difference between fruits.txt and Colors.txt files.
diff file1 file2 Ex: diff fruits.txt colors.txt