Essential Linux Commands For DevOps

Search for a command to run...

Thank you!
Thank you so much😊 Glad that I could help you
Thanks Aayush for giving a read
Thanks for reading :)
Why EndpointSlices exist, what is actually inside one, the three conditions that decide who gets traffic, how topology hints route zone-aware, and a live cluster demo.

A code-level deep dive into the NVCF monorepo: three-plane architecture, NATS JetStream scale-to-zero, multi-cluster routing, and how to contribute.

Why Services exist, what happens when you create one, the full request flow from curl to backend pod, and all five Service types with real use cases. Verified against kubernetes/kubernetes 1.36 source.

7 Days of Docker (2026) - The Finale. A Docker Captain's guide. Not your average tutorial. Your container is probably not safe to ship. I know that sounds harsh after six days of building. You have i

7 Days of Docker (2026) - A Docker Captain's guide. Not your average tutorial. I'm a Docker Captain. And if you'd told me two years ago that I'd be pulling AI models from Docker Hub the same way I pu

Most input lines entered at the shell prompt have three basic elements:-
The command is the name of the program you are executing. It may be followed by one or more options (or switches) that modify what the command may do. Options usually start with one or two dashes, for example, -p or --print, in order to differentiate them from arguments, which represent what the command operates on. However, plenty of commands have no options, no arguments, or neither.
ls → Use to see all the list of files or folders inside a directoryls -a → list of all the files and folders including hidden files & foldersls -l → Use to see all the files and folders including file permissions as wellls -al → combine the above two commands - hidden files and folders + details ls -R → show all the sub directory of a directorycd <directory name> → it is used for changing from any directory into another directorycd.. → go back to previous foldercd - → change to previous directorycd ~ → go back to home directorypwd → print working directory or present working directoryman <command> → describes the manual about any command. → the current directory.. → the previous directorycat <filename> → Use to show the content of any file quickly in the terminaltac <filename> → Use to look at a file backwards, starting with the last line.cat > <filename> → quickly create a file of given filename and add some content in it.
> → Redirection command: redirect the output to some other filecat file1 file2 > file3 → concatinate the content of file1 and file2 and paste that merged content into file3
echo → Use to print anything in the terminalecho "something" > filename → add the text into the mentioned filetree → displays a tree view of the filesystemmkdir <dir name or path> → Use to create any new directory
mkdir sampdirmkdir /usr/sampdirmkdir -p dir1/middle/dir2 → creating a directory in the middle of dir1 & dir2rmdir <dir name> → Removing a directory is done with rmdir. The directory must be empty or the command will failrm -rf <dir name> → To remove a directory and all of its contents recursively, it is extremely dangerous and should be used with the utmost care (-rf means forcely remove)rm -f → Forcefully remove a filetouch <filename or path> → create a new filecp <filename> <new filename> → Use to make a copy of a file
cp file1 file2 → It will make a copy of file1 and naming that file2mv <filename> <location> → To move a file to a new location
mv <filename> <newfilename>
mv files.txt newfile.txt → Here files.txt will be moved to newfile.txt but newfile.txt
does not exist for the first time. So, files.txt will be moved and also renamed as
newfile.txtlocate "file extension" → locates all the files with the same extension as mentioned
locate "*.txt"
sudo → super user do (it provides the administrative permissions). It always ask for sudo password because it is kind of admin control command.df → it shows disk space usage in kb but if we write df -m then it will show usage in mb
df -h → -h is a flag which means human readable formatdu → it shows disk usage statistics. It also has flag du -h means in human readable formathead <filename> → It prints by default first 10 lines of the given file
head -n 4 <filename> → will only display the first 4 lines.less → Used to view larger files because it is a paging program. It pauses at each screen full of text, provides scroll-back capabilities, and lets you search and navigate within the file.tail → Used to print the last 10 lines of a file by default
tail -n 5 <filename> → will display the last 5 lines.diff file1 file2 → compares both the files & print the uncommon linesfind → find things in a file or a directory
find /usr -name gcc → Searching for files and directories named gccfind /usr -type d -name gcc → Searching only for directories named gccfind /usr -type f -name gcc → Searching only for regular files named gccfind -name "*.swp" -exec rm {} ’;’ → To find and remove all files that end with ".swp". The {} (squiggly brackets) is a placeholder that will be filled with all the file names that result from the find expression, and the preceding command will be run on each one individually. you have to end the command with either ‘;’ (including the single-quotes) or "\;"man findThere are three types of permission:
These permissions affect three groups of owners:
ls -l <filename> → shows the file permissions for that particular file
Example:-
ls -l myfile.txt
-rw-r--r-- 1 bishal bishal 98 May 4 23:07 myfile.txt

Changing the file permissions
using chmod command
chmod u=rwx,g=rx,o=rw <filename>
rwxrxrwUsing octal numbers with chmod
chmod 777 <filename>777 → -rwx all three permission fully accessable for user,group & others.Categories
4 → if read permission is desired3 → if write permission is desired1 → if execute permission is desired.0 → no permission(Thus, 7 means read/write/execute, 6 means read/write, and 5 means read/execute.)
Example:-
chmod 577 myfile.txt
(Here User have read and execute permission only as 5 and group,others have all permission as it's 77)
Changing the users of a file
chown command
sudo chown root <filename>
sudo as we are accessing root permissionsroot user has the highest number of permissions in linux/unix based systemsgrep command
Case sensitive
Versions of grep:
grep -V
Mac → BSD grep
Simple searching a word
grep "bishal" names.txt
**bishal**
Expanding the whole word
grep -w "bishal" names.txt
**bishal** das
-w (means word-regexp), we searched for the “bishal” & it returned the whole string associated with that word!To ignore the search case-sensitivity
grep -i "bishal" names.txt
**bishal** das
Print the line number of the word
grep -n "bishal" names.txt
1:bishal das
Print lines after & before the word
grep -B 5 "bishal" names.txt
Carlos santana
Ishan kurnawat
Micheal cade
John irshad
Arsab roy
**bishal** das
-B 5 → means print 5 lines before the actual word we are searching
grep -A 5 "bishal" names.txt
-A 5 → means print 5 lines after the actual word we are searching
To search the entire directory for a word
grep -win "bishal" ./*.txt
.txt files in the current directory for the word (-w/-i/-n all flag together = win)Which file contains a match and count all file
grep -wirl "bishal" .
using the -l tag here, we found the list of file that contained “bishal” in the current directory
grep -wirc "bishal" .
using the -c tag here, we count the list of file that contained “bishal” in the current directory
regex to searchvi .bashrc or gedit .bashrc commandalias gpom = 'git push origin main'
. ~/.bashrc in your terminal (home directory) Useful terminal shortcuts
history command
to directly use a command from history
!<history-number>
ctrl + A → Cursor goes to the begining
ctrl + e → Cursor goes to the endctrl + k → after cursor all will be deletedctrl + u → entire command will be deletedctrl + r → search previous command; → to use multiple commands in the same line
git add .;git commit -m "message";git push origin main
ping <URL> → to check the connectivity status of a website by sending packets (ping - Packet Internet Groper)wget <URL> → to download any file from the internetapt installbrew installyum installtop → process running + CPU usagekill <process_id> → to stop a running processuname → prints out your OS namezip & unzip
zip details.zip name.txt phone.txt → create a zip file named "details.zip" and zipped two files "name.txt" & "phone.txt" into "details.zip"unzip details.zip → it will unzip "details.zip"hostname → prints the host’s name
hostname -i → ip address of hostnslookup <URL> → checkout ip address of a domainnetstat → show all the portsps aux → showing all the running processes with PIDvmstat → checking your virtual memoryid → to check user & group id’sgetent → if a particular user exists or notlscpu → all details of cpulsof → list all the open files& operator&& operator
echo "first" && echo "second"
first command is completed, then the second will run; operator|| operator (OR)| operator (pipe)!() operator (NOT)> → over-write>> → append
echo "hey" >> names.txt
{} → combination operator
Thanks! for reading this blog :)
Hope this blog will help you!👍
Follow Kubesimplify on Hashnode, Twitter and Linkedin. Join our Discord server to learn with us.