Basic Linux Commands for Devops Engineer/Linux Administrator
1. "Sudo" --- Super User which have every permission required
2. "ls" --- Is used to list down all the files and directory in your current terminal session
// we can use different flags with it like
ls -a --> for all the content
ls -l --> for lenghty view of content
ls -al --> combination of 1st ad 2nd command
3. "pwd" --- Is used to show or preview your present working directory
4. "mkdir" -- Allow user to make a directory/Folder
mkdir -p dir1/dir/2/dir3/dir4 -- Allows you to make directory in directory
5. "#" -- This Command is used to make comments in your linux terminal
6. "cd" -- Helps you to change your directory
Back to home directory -- "cd"
Back to previous directory -- "cd .."
Back to root directory -- "cd /"
7. "touch" -- Create a file -- You can't edit it
to make that happend install vim or nano those are the editor
sudo apt install nano -- for nano editor
you can type-- nano filename
to save your file type- 1)ctrl o 2)Enter 3)ctrl x--to exit
For Vim :-
sudo apt install vim
You can Type-- vim filename
to save your file type- 1)ESC - 2)wq:
8. "cat" -- This command is used to run the content if in case you dont want to edit it
// we can use flag and it will change functionality like -->
cat "Hello" >> hello.txt
--it will add content to the file
9. "cp" -- This command is used to copy
cp file1 file2
10. "mv" -- This command is to mv as well as to rename it
11. "ping" -- To check the connectivity of servers or a host
// If you want to get 5 request only
command -> example ping -c 5 www.google.com
12. "curl" -- This Command is used to transfer the data to or for server
// example -> curl https://google.com
// to copy the data from a website to a readme file following command
curl -o readme.txt (website url)
13. "wget" -- same as the curl command but people prefer to user curl as it is more secure and has advance features and also has parallel download support and it also amke system faster
14. "echo" -- It echo's what you type.Is used to for encording and decording purposes
//encording - echo tohid | base64 -- it will encode for you and will return = dG9oaWQK
//decording - echo dG9oaWQK | base64 --decode
this will decode your encoded name and will return = tohid
15. "ps" -- This command is to give you process ID
// ps aux -- long list of description
16. "grep" -- This command is used to filter out the process or
// ps aux | grep word
Entire DATA- pipe it -filterout - admin
17. "wc -l" -- This command counts no of lines
// example-> cat readme.txt | wc -l
18. "netstat" -- For security which gives you give sall network related information
// to install netstat
apt install netstat -- if not try another command
apt install net-tools
19. "alais" -- this is used to set a nickname
// this is not recommeded because it will make you confused and can be very serious
20. "ls" & "ls -l" -- list all the files with there permissions
// u -> owner, g -> group, o -> others,
a -> all. + -> add, - > means take away
r -> read, w -> write, x -> execute
21. "chmod" -- is used to change permissions of the file
// example -> chmod ref ops filename
chmod a+x filename-- this will change permisions for file
22. "gzip" -- This commands compresses your file
//example -> gzip filename -- done
23. "tar" -- For creating and extracting the archive files
// example -> tar cvf filename.tar folder name
24. "ssh" -- Used to get into another machine or using private session
//example -> ssh keygen -- savekeyinfile--
--- cat in folder copy key
command - ssh -i filename usernam-hostip
you are now able to access it
25. "scp" -- To send a file to a particular remote server
// scp -i filenamewithpath hostname@ip:path
26. "rm" -- It is used to remove your file or directory
// to remove file type -> rm filename
// to remove directory -> rm -rf filename
27. "FREE" -- It is used to see free used memory in the system
28. "SS" -- Investigate Sockets
29. "DU" -- it used to estimate file space usage
// we can use flags with it like
// -h =humanreadable
// -a = to show all available content
30. "DF" -- It is used to estimate file space usage
// we can use flags with it like
// -h =humanreadable
// -a = to show all the contents
31. "VI" -- It is an editing command it will open editors like nano and cat called VIM
32. "NANO" -- It is an editing command it will open editors like Vi and cat called NANO
33. "PING" -- It is used to send ICMP request to the network Host
34. "HOSTNAMECTL" -- It is used to set hostname for user
35. "USERADD" -- It will