I am Linux small white, because the project in contact with Linux soon, the collection of some common Linux commands, hope to be useful to the later.
--List the top 100 files in the/var/data directory by a-Z alphabetical order
Ls/var/data |sort|head-100
--List the top 100 files in the/var/data directory sorted by a-Z letter
Ls/var/data |sort-r|head-100
--See if the program Testwatcher is running
PS Aux|grep Testwatcher
--Check if the program Testwatcher is running and exclude itself from this query process
PS Aux|grep Testwatcher | Grep-v grep
--Delete a file or folder (no hint)
Rm-rf/data/testfolder
--View file properties
Stat/data/testfolder.zip
--Compression
Zip-r/data/testfolder1117.zip/data/testfolder
--Overlay Decompression
Unzip-o/data/testfolder.zip
--View Time
Date
--Set the date and time
Date-s "2015-10-10 12:12:12"
--Set time zone
Timedatectl Set-timezone Asia/shanghai
--Reclaim memory
Echo 3 >/proc/sys/vm/drop_caches
--Copy file (clip)
cp/data/new2.csv/data2/xdata/
--RPM Package Installation Command
rpm-ivh/opt/aaaa.rpm
--query which packages have been installed
Rpm-qa
--Shut down immediately
Shutdown-h now
--Unzip the tar.gz format file
Tar-xzvf/opt/1.tar.gz
--Restart
Reboot
--View process status
Ps-x
--View the specifics of a PID (example 4900)
Lsof-p 4900
Cat/proc/4900/status
--Push files (clips) to another machine or to the machine
Scp-r/opt/* 192.168.100.20:/opt/
View Memory
Free-m
Free-h
To view mounted hard disk conditions
Df-ht
--to the directory to execute, can only count the next level of files and folders
LS |wc-l
--Statistics file number and size, max-depth represents the maximum number of layers
Du-sm/opt/data
Du-h--max-depth=1/opt/data
--View CPU, memory and other usage
Top
--Start looking for all text files with a. log extension from the/data directory and find the line that contains "ERROR"
Find/data-type f-name "*.log" | Xargs grep "ERROR"
--Example: start looking for all text files with an. In extension from the current directory and find the line that contains "Thermcontact"
Find. -name "*.in" | Xargs grep "Thermcontact"
Some common commands for Linux