Linux Common command Set (file and directory operations, 40 total)

Source: Internet
Author: User
Tags create directory parent directory

---restore content starts---

1. ls

"Command Function"

List and display files in a directory

"Command Syntax"

ls [options] [parameters]

"Common Options"

-L long format display (entry attribute, file type, permissions, number of hard links, owner, genus, size, time, file name)

-A shows hidden files, including "." and ".", Linux defaults to "." The file that starts with is a hidden file)

-A shows hidden files (not including ".") and ".." )

-I display inode number

-D displays only the specified directory

-1 single-column display

-R Recursive display

 

"Parameter description"

directories or files (absolute and relative paths are supported, absolute paths start with "/", relative paths are paths starting with the current directory)

"Command Example"

LS (lists and displays the contents of the directory, and does not follow the path to display the contents of the current directory)

Ls-l (listing and displaying content in a directory in long format)

Ls-a (Show hidden files and directories Note that there are "." and ".." )

Ls-a (Show hidden files and directory not "." and ".." )

Ls-i (displays Inode, the number in front of the file name is the inode number)

Ls-ld (displays only the directory,-D itself cannot be used alone, it needs to be used in conjunction with other options, where ad is the short option-L and-D merge)

Ls-1 (Single display)

Ls-r (Recursive display)

2. pwd

"Command Function"

Print the current working directory and display it as an absolute path

"Command Syntax"

Pwd

"Common Options"

No

"Parameter description"

No

"Command Example"

PWD Prints the current working directory and displays it as an absolute path

3. cd

"Command Function"

Switch working directory

"Command Syntax"

cd [parameter]

"Common Options"

  

"Parameter description"

directories that support absolute paths and relative paths

"." Represents the current directory

".." Represents the previous level of the directory

"~" means the user's home directory (default parameter, which can be switched to the home directory of the specified user when the administrator is followed by the specified user)

"-" returns to the previous working directory (can be switched back and forth between two directories)

"Command Example"

CD switch to current user home directory

Cd. Switch to current directory

Cd.. Switch to the top-level directory in the current directory

CD ~name switch to name user home directory

CD-Back to previous working directory

4.touch

"Command Function"

Update to the time that the file exists or create a new empty file

"Command Syntax"

touch [Options] Parameter

"Common Options"

-T change time to specified date, [cc[yy[mm[dd[hh[mm]

The first two digits of the specified year for CC. YY the following two digits for the specified year. MM Specifies which January of the year (from 01 to 12). DD Specifies which day of January (from 01 to 31). HH specifies which hour of the day (from 00 to 23). MM specifies which minute of an hour (from 00 to 59).

"Command Example"

Touch 123 (Create empty file 123)

  

TOUCH-T 202006252230 123

5. Echo

"Command Function"

Print a variable value or output a specified string

"Command Syntax"

Echo (parametric)

"Common Options"

No

"Parameter description"

Can be a variable or a string

"Command Example"

echo $UID Reference system variable UID

Echo 123 print 123 to standard output

6.mkdir

"Command Function"

Create a Directory

"Command Syntax"

mkdir [Options] Parameter

"Common Options"

-P When the parent directory does not exist, create a parent directory

"Parameter description"

The directory name and path that you need to create, support absolute and relative paths, and do not add paths when the current working directory is created by default

"Command Example"

mkdir zxc Creating a directory Zxc

Mkdir-p a/b/c/d/e/f Step by step Create directory

7.cp

"Command Function"

Copy a file or directory

"Command Syntax"

CP [Options] source Path destination Path

"Common Options"

-P Reserved Source file property copy

-R recursive replication, the default CP command cannot replicate content in the directory, you can add this option to copy the contents of the directory

-F Forced replication

-V shows the replication process

"Parameter description"

Both the source and destination paths support absolute and relative paths

"Command Example"

CP 123 zxc/Copy 123 to directory Zxc

Cp-p 123 zxc/Preserve source file properties copy 123 to directory Zxc

Cp-r VMWARE-TOOLS-DISTRIB/ZXC

8.mv

"Command Function"

Move or rename a file or directory

"Command Syntax"

MV [options] source file path Destination path

"Common Options"

-F Force Move, if there is a duplicate name forced overwrite

"Parameter description"

Can be a file or directory

"Command Example"

MV vmware-tools-distrib//root/a


9.rmdir

"Command Function"

Delete Empty Directory

"Command Syntax"

rmdir [Options] Parameter

"Common Options"

-P deletes the specified directory if the upper-level directory of the directory has become an empty directory.

-V Display procedure

"Parameter description"

If you want to delete multiple empty directories, you can separate them with spaces

"Command Example"

rmdir-pv/b/c/d/e

10.rm

"Command Function"

Delete files or directories and delete multiple files or directories, RM deleted files and directories cannot be recovered

"Command Syntax"

RM [Options] Parameter

"Common Options"

-R Recursive Delete, commonly used to delete directories (when there are files in the directory directly using RM cannot be deleted, must append-r option)

-F Force Delete

-V Display procedure

"Parameter description"

Directories or files must have the-r option if they have files in the directory

"Command Example"

  

11.nano
"Command Function"

A vanity editor in the form of a window

 

12.vi/vim

One of the text editors

13.shred

"Command Function"

Write random values

"Command Syntax"

Shred [Options] ... Parameters

"Common Options"

-F Mandatory

-n Specifies the number of overrides (default three times)

"Parameter description"

Can only be a file

"Command Example"

  

14.cat

"Command Function"

Connect files and output to standard output devices

"Command Syntax"

Cat [Options] Parameter

"Common Options"

-N Display Line number

"Parameter description"

File, multiple files can be separated by a space

"Command Example"

  

15tac

"Command Function"

Same as the cat command, but in reverse order.

"Command Syntax"

Cat [Options] Parameter

"Common Options"

No

"Parameter description"

File, multiple files can be separated by a space

"Command Example"

  

16.nl

"Command Function"

Calculate line number

"Command Syntax"

NL [Options] Parameter

"Common Options"

-B A: Indicates that the line number (similar to cat-n) is also listed, whether or not it is a blank line;

-N LN: The line number is displayed at the left of the screen;

"Parameter description"

File

"Command Example"

17.more

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"

18.less

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"
19.head

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"

20.tail

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


21.grep

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


22.cut

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


23.sort

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


24.tr

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


25.wc

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


26.uniq

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


27.tee

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


28.diff

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


29.du

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


30.ln

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


31.type

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


32.file

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


33.stat

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


34.which

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


35.whatis

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


36.whereis

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


37.locate

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


38.find

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


39.help

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"


40.man

"Command Function"

"Command Syntax"

"Common Options"

"Parameter description"

"Command Example"

Linux Common command Set (file and directory operations, 40 total)

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.