Syntax knowledge for shell Scripts 3

Source: Internet
Author: User

① managing Linux

W View the current system load

/proc/cpuinfo Saving server CPU related information

Grep-c ' processor '/proc/cpuinfo Compute server CPU Count

Vmstats Monitoring System Status

Top Displays the system resources that the process occupies

SAR Monitoring System Status

Sar-n DEV View network card traffic

Xargs the output of other commands as input to subsequent commands

Find./-mtime +10 | Xargs RM

Find *.txt | xargs-n1-i{} mv {} {}_bak

Modify all files with the suffix. txt. txt_bak;-n1 to represent an object to handle;-i{} means to replace each object with {}

-exec is often used in combination with find

Find./*-exec mv {} {}_bak \; Add the file name of the file under the current directory _bak;{} to represent each file object

Nohup do not hang up Run command

Nohup SH task.sh &

Sometimes even if the script is running in the background, when the user exits the login, the script exits, and after using the Nohup command, the script will continue to run without hanging up.

tar [-ZJXCVFPP] File

-Z gzip compression-j bzip2 compression-X unpack or unzip-T view the contents of the TAR package-C build a tar package or zip file Package-V Visualization

-F compression with the file name to indicate the name of the package, extract the file name to extract the files, if there is-F, write F to the last

-P Reserved Source file Property-P can use absolute path--exclude filename Extract do not say filename file included

Gzip Compression Tool

gzip [-d#] File

Compressed file, the suffix will become file.gz;-d used during decompression;-#表示压缩等级, #值在1-9, 1 worst, 9 best, default 6;gzip not available to compress directory

bzip2 [-dz] File

-D user decompression;-Z for compression, can be omitted; As with gzip, you cannot compress a directory

Syntax knowledge for shell Scripts 3

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.