Most useful Linux commands for DevOps
To use and get comfortable with Linux, you need to learn Linux commands. Most of things in Linux is done by terminal. So you need to know some commands of Linux to work Linux terminal. Here in this blog I have find some commands that is very useful in DevOps area as per my perspective.
So here, In this blog I have figured out some Linux commands. This commands are very useful when you interact with Linux terminal to get your work done. In DevOps job, We need to deal with configuration, solving errors, maintenance etc.. .Therefor we have to know this useful Linux commands to automate process and get our work easier.
➤ Widely use Linux commands
- To find the description of each Linux commands in terminal
man command-name
- To add-user / add-group in system
sudo adduser user-name
- To change ownership of file
chgrp user-group filename
- To change file access permission
chmod a+rwx filename
(where a = user for give permission to all class
r = read, w = write, x = execute )
- To give alias name to Linux command but it works till the terminal open. It destroy when you restart terminal.
Syntax : - alias alias-name='Linux command'
Example : - alias download='cd ~/Downloads'
- To give permanent alias name to Linux commands open .bashrc file in edit mode in terminal ( $nano ~/.bashrc ) , At the end write your alias name
Syntax : - alias alias-name='Linux command'
Example : - alias download='cd ~/Downloads'
- To update new software package
sudo apt-get update
- To content of file in terminal window
cat filename
- To run command periodically with frequency defined in days, weekly, and months. Add following command at the end of ( /etc/anacrontab ) file.
Syntax : - period delay job-name command
Example : - @daily 10 example.daily /home/nikunj/script/backupsync.sh
- To display 10 last line of file
tail -n 10 filename.txt
- To copy file in terminal
Syntax : - cp option source destination
Example : - cp /home/file ~/
(to move directory use -R option )
- To display disk space of system
df -h
df -hT /home
- To find file in directories
find . -type f filename.txt ( . indicate current directory)
find . -maxdepth -newermt "2020-01-30" (find file on by date of modifies)
- To search for specified pattern in file
grep 'hello' file.txt
- To display cpu and memory usage
top
- To display system info
uname -a
- To search repository
apt-cache search file-name*
- To check currently logged in user
w
- To check network activity and configuration
netstat
sudo netstat -ln | grep -w "3000" ( To find particular port which in use or not )

Comments
Post a Comment