Linux Common Commands

Source: Internet
Author: User

Linux Common commands

Show directory and File commands

LS: Displays directories and files under the specified directory

ls [option] Directory name

Ls-a: List all files in the directory

ls-d: Show directory, do not display directory files

Ls-i: Display the index point of a file

Ls-k: File size in bytes

Ls–l: Listing details of a file

Ls-r: Displays the contents of the specified directory and sub-directory

Ls-t: Sort by Time

Ls-a: File size sorting

Show file Contents command

Cat [Options] File name

Cat-n: Number of lines starting from 1 for all outputs

Cat–b: Similar to-N,-B does not number blank lines

Cat–s: When there are more than two rows of blank lines, replace them with a blank line

More commands

more [options] [filename]

More–num: Number of rows displayed at one time

More +num: Starting from the first few lines

More-s: When you meet more than two lines of blank line is replaced by a row

Less Pagination Display Commands

less [options] [filename]

Less–n: Show Remove line number

Less-s: Compressing multiple empty rows into a blank line

Head Command

Head [options] File name

Head–c: How many bytes before the file is displayed

Head-n: How many lines before the file is displayed

Head-q: The file name is not displayed before displaying the contents

Head-v: Displays file names before displaying the contents of the files

Tail command

tail [options] File name

Tail-c: Displays the number of bytes after the file

Tail-n: How many lines are displayed after the file

Tail-q: File name is not displayed before displaying files

TAIL-V: Show file name before displaying files

TAIL–F: Dynamic display of n-line content at the end of a file press CTRL + C to terminate the display

mkdir command

mkdir [Options] [file name]

Mkdir–p: Ensuring the existence of directory names

rmdir [Options] [directory name]

RmDir: Delete Empty directory

Rmdir–p: When a subdirectory is deleted and then made empty, it is deleted

Touch command

touch [Options] File 1 [File 2]

Change the file's time record to be the same as Install.log

RM command

RM [Options] [file name or directory]

Rm–i: Ask for confirmation before deleting

Rm–f: Even if the source file makes read-only, it is also deleted directly, do not need to ask each

rm–f–f*: Delete all files beginning with F

CD command

CD file name: Enter the folder

Cd ~: Current User home Directory

Cd.. Return to the previous layer:

PWD command

Show current user and working directory

CP command

CP [Options] [source file or directory] [destination file or directory]

Cp–r: Recursive continuous replication for directory replication behavior

Cp–f: Forced replication

Find cmin–n: Files read in the last few minutes

Find–ctime-n: Files read in the past few days

Find-name Name: Find file names that match name

Find–size: Search by File size

find-printf: Display files on standard output devices

find-cnewer [FileName]: file that is newer than [file name]

Find–type–f: Find files of a generic type

Find-mount: Checking and specifying directories under the same file system file

Find–ls: Detailed listing of the files you are looking for

Locate *.cfg: Find all. cfg files

LOCATE-H: Display auxiliary information

WC command

wc-c [Options] [filename]: Show file size

wc–m [Options] [filename]: Number of statistical strings

wc-l [Options] [filename]: Number of rows in the statistics file

Sort–u: Show non-repeating content

Sort–r: Reverse Sort

Clear: Perform a clear screen

Cat [file name] | TR "ABC" "XYZ": Replace related letters in standard output content

Tr ' A-Z ' A-Z ' < kong.txt: capitalization of standard input lowercase letters

Tar Package compressed file

Gzip format compression

Decompression hour compression frequency

Linux Common Commands

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.