Linux Common Command Collection

Source: Internet
Author: User

RM-RF + folder name Delete this directory
RmDir Delete Empty Directory
mkdir + File creation directory
Clear Clear Screen
PWD Current Path

Ll-i Display the file node, use Find./-inum XXX (node number)-print-exec RM-RF {}; Delete garbled files
sudo mv + file modified filename/path/

Shutdown-t + time period (s) after shutdown
Shutdown-h 20:25 20:25 shutdown
Shutdown-h immediately shut down the machine
Shutdown-r restart

IP a view native Ipsudo reboot restart now Ps-ef | grep "python" view native python boot information tail-100f text.log//tail-f-n text.log last 100 rows real-time update log chmod 777 + file name gives maximum permissions chmod +x + file name Give execute permission MV test.txt wbk.txt # # Rename the file Test.txt to Wbk.txt

Unzip Xxx.zip./* # Zip Unzip

Unzip xxx.zip-d XXX # # Extract to the specified directory

TAR-XZVF xxx.tar.gz # # tar.gz Unzip

. tar
Compression: Tar cvf filename.tar FileName
Decompression: Tar xvf Filename.tar
---------------------------------------------
. gz
Decompression 1:gunzip filename.gz
Decompression 2:gzip-d filename.gz
Compression: gzip FileName
. tar.gz
Decompression: Tar zxvf FileName.tar.gz
Compression: Tar zcvf FileName.tar.gz DirName
---------------------------------------------
. bz2
Decompression 1:bzip2-d filename.bz2
Decompression 2:BUNZIP2 filename.bz2
Compression: Bzip2-z FileName
. tar.bz2
Decompression: Tar jxvf FileName.tar.bz2
Compression: Tar jcvf FileName.tar.bz2 DirName
---------------------------------------------
. BZ
Decompression 1:bzip2-d filename.bz
Decompression 2:BUNZIP2 filename.bz
Compression: Unknown
. tar.bz
Decompression: Tar jxvf FileName.tar.bz
Compression: Unknown
---------------------------------------------
. Z
Decompression: uncompress filename.z
Compression: Compress FileName
. Tar. Z
Decompression: Tar zxvf filename.tar.z
Compression: Tar zcvf filename.tar.z DirName
---------------------------------------------
. tgz
Decompression: Tar zxvf filename.tgz
Compression: Unknown
. tar.tgz
Decompression: Tar zxvf FileName.tar.tgz
Compression: Tar zcvf FileName.tar.tgz FileName
---------------------------------------------
. zip
Decompression: Unzip Filename.zip
Compression: Zip Filename.zip DirName
---------------------------------------------
. rar
Decompression: rar a Filename.rar
Compression: RAR e Filename.rar

1. Query log for information containing a keyword cat app.log |grep ' ERROR '

2. Query the log at the end of the last 10 lines of the log tail-n App.log

3. Query all logs after 10 lines tail-n +10 App.log

4. Query the first 10 rows of logs in the log file Head-n App.log

5. Query the log file except for the last 10 rows of all other logs head-n -10 App.log

6. The query log contains information about a keyword, showing the travel number (modified on the basis of 1) cat-n app.log |grep ' ERROR '

7. Display 102 rows, the first 10 lines and the last 10 rows of the log cat-n app.log |tail-n +92|head-n 20

8. Query according to the date time period (the prerequisite log must always print the date, first to determine if there is a point in time) Sed-n '/2014-12-17 16:17:20/,/2014-12-17 16:17:36/p ' App.log

9. Use the more and less commands (paging, using a space page) cat-n app.log |grep "error" |more

10. Save Log to file Cat-n app.log |grep "error" > Temp.txt
*************************************************************************************************

Linux Common Command Collection

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.