Common centos command line operations, centos command line
1. view port usage
Lsof-I tcp: 80
2. check whether a firewall is installed.
Service iptables status
Check whether firewall is enabled
/Etc/init. d/iptables status
3. view all installed packages
Yum list installed
4. Check the number of php-fpm executions.
Ps-fe | grep "php-fpm" | grep "pool" | wc-l
5. The centos memory usage is too high.
Sync
Echo 3>/proc/sys/vm/drop_caches
6. view the linux version
Cat/etc/issue
7. nginx installation path
Whereis nginx
8. Restart the reboot server.
9. server shutdown halt
10. convert files to zip files
Zip-r name.zip/www/
Encapsulate gz
Tar-zcvf db1.tar.gz db1
Tar-zxvf db1.tar.gz unzip gz
11. Decompress tar. xz in linux.
Use xz-d xxx.tar. xz to decompress xxx.tar. xz to xxx.tar.
Decompress tar-xvf xxx.tar
12. view the current folder File Size
Du-sh/home
Ls-lh
13. Copy folder 123 and rename the folder to 456.
Cp-rv/ecmoban/123/ecmoban/456
14. copy to the current folder and rename it
Cp-r mm./mmmm
Copy folder A to directory B
Cp-rv A B
If you are in directory B, you can:
Cp-rv ./
Copy the A1 file under file
Cp-v A/A1 ./
Or
Cp-v A/A1 B/
15. Use vim
Crontab-e for editing
Ctrl + c => shift +: => input wq to save
: Q! Exit and do not save
16. View resources used
Df-h
17. delete an object
Rm-rf ..
18. Modify the folder or file name
Mv ....
19. Change the permissions of folders and subfolders
Chmod-R 777 ..
Chown-R-v root: mail test6
20. Copy commands between linux
Scp-r/home/work/source.txt work@192.168.0.10:/home/work/workers copy the local source.txt file to the/home/work directory on the 192.168.0.10 Machine
Scp-r work@192.168.0.10:/home/work/source.txt/home/work/workers copy the source.txt file on the 192.168.0.10machine to the local/home/work directory
21. view the system version
Cat/etc/issue number of digits getconf LONG_BIT
Cat/proc/cpuinfo | grep "processor" | wc-l view cpu count
22. view the number of php-cgi Processes
Netstat-anpo | grep "php-fpm" | wc-l
23. view the five most occupied memory
Ps-aux | sort-k4nr | head-5
24. Memory cleanup method
Sync
Echo 3>/proc/sys/vm/drop_caches
25. nginx AB testing
AB-c 100-n 1000000-k http: // 127.0.0.1: 8080/
26. Install the sar tool to obtain the network card-level traffic Diagram
Yum install sysstat
# Obtain the network card Traffic Diagram
Sar-n DEV 1 5 // obtain the value once every second, five times in total. Eth0 is the Intranet Nic, and eth1 is the Internet Nic.
27. Install the iftop traffic monitoring tool on the server
Yum install iftop-y // install the tool
Iftop-I eth1-P // use netstat-tunlp | grep 53139 // process corresponding to Port