Viewing disk I/O Usage [iostat]
Iostat -x 2 5 ## Check the I/O status and run the command every 2 seconds for a total of five times
Viewing memory Usage [free]
Free -m ## Check memory usage
Viewing Cpu Usage [TOP]
Top # # dynamic show the resources such as CPU, memory usage, a top every few seconds – n 1 # # to see a top command execution, directly after the return to the top, press the shift key + capital M # # top, then press the memory footprint ranking top in reverse chronological order, Press shift + capital P ## to execute top, then sort by Cpu usage in reverse order
View file size [du/ll, etc.]
Du -h –max-depth=1 ## check the size of each folder du -sh. ## check the size of each folder
View the exact time the process started and the elapsed time since it started
# #, such as checking process Ete100015CollectStart precision time and start time passes by ps – eo pid, lstart, etime, CMD | grep Ete100015CollectStart | grep -v grep
Example result:
[sendi@localhost ~]$ ps -eo pid,lstart,etime,cmd | grep qmgr |grep -v grep
1800 Wed May 19 15:21:12 2021 56- 21:39:17 qmgr -l -t unix -u
Copy the code
Viewing file Contents
Vi ## more ## Cat ## Cat #
Viewing log content [tail]
##tail -f used to view the end log of the file and lock the scroll refresh, used to view the Tomcat or Springboot program log, such as: Tail -f/home/testuser with/tomcat/logs/error log # # tail – 1000 used to view the file at the end of the 1000 lines of log, Such as/home/testuser with tail – 1000 / tomcat/logs/error log
Find Linux commands for specific files and specific contents in a directory
Select * from current directory where filename contains “trace-“, And the file content contains “172.168.201.177 # 13” file find. -type f – the name “trace -” | xargs grep “172.168.201.177 # 13 – # # l query file and filter the content without permission, Example find / -name “bloc- cloud-gateway-2.1.4.release.jar “2> /dev/null
[find]
-type f -size +800M find. -type f -size +800M
Decompress/compress
Gz ##tar Decompress filename.tar. gz to the current folder: tar ZCVF filename.tar. gz DirName Zip folder DirName to filename.tar. gz
Zip ## Unzip filename.zip ##unzip filename.zip unzip -o -d /home/sunny myfile.zip ## Unzip filename.zip to /home/sunny/ zip -r Filename. zip dirName ## Zip the dirName directory into filename.zip
Method of clearing files
The first method is echo “” > a.txt ## Clear the file by echo
## The second way to clear the file via redirection > a.txtCopy the code
Cat > a.txt << EOF EOFCopy the code
Linux Proxy Internet access Settings
If there is an HTTP proxy server 192.168.56.1, port 1080, account admin, password admin123 export http_proxy=http://admin:[email protected]:1080 ## export https_proxy=http://admin:[email protected]:1080 ## export no_proxy=’127.0.0.1′ ## filter 127.0.0.1 access not to the proxy
cat
Cat top. Out # # to check the top. The out file. The content of the cat top out | grep nginx. # # to check the top out file and the content of the filter show only the part with “nginx”
# # in the/etc/security/limits file additional content to a file in the end, if the > > >, is to generate additional replacement rather than a cat > > / etc/security/limits the conf < < EOF * soft nofiles65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
EOF
Copy the code
cd
/root/liu/liu /root CD /usr/local/ JDK ## CD /usr/local/ JDK
crontab
Crontab -e ## Run the wq command to save the configuration
echo
Echo “ab” >> a.txt ##echo appends “ab” to the end of a.txt. Echo “ab” > a.txt ##echo “ab” > a.txt ##echo “a.txt”
ls
##ls displays only the file name
ls -l | grep ^[^d] | awk '{print $9}'
Copy the code
Ls-hl ## Displays all files in the directory, one line at a time, in the human way
mkdir
# mkdir /home/testuser/tempdir # mkdir /home/testuser/tempdir Mkdir /home/testuser/tempdir -p ## /home/testuser/tempdir -p ##
netstat
Netstat lntup # # check system port usage netstat lntup | grep in taking up 8188 # # to check the system application situation of 8188,
ps
Ps – ef # # to check all the process of ps – ef | grep Java # # to check all of the Java process
rm
# # absolute path through the rm – rf files, delete files, such as the rm – rf/home/testuser with/teerror. The log
rpm
Qa # # RPM – view all installed RPM package RPM – qa | grep python # # to check the name contains python RPM package RPM – the ivh rpmName # # RPM installation software, bring the RPM file name
sed
## replace * soft nproc 4096 with 65536 sed -i ‘s/^* soft nproc 4096$/* soft nproc 65536/’ /etc/security/limits.d/20-nproc.conf
#### Common syntax for sed substitution strings sed -i's/Search_String/Replacement_String/g' Input_File
Copy the code