4 Linux file and directory management

Linux file directory structure of a tree structure, most top-level directory for the root directory /

Other directories can be added by mounting them to the tree, you can remove them by unmounting

Absolute path:

Start at the root eg: / usr / share / doc

relative path:

Help start root directory eg:. . / Man

 

Common treatment fame directory

ls: List directory

-a: All files, together with (The file begins with a) be listed with hidden files

-d: list only the directory itself, rather than list the files in the directory data

-l: long serial data out, it contains the attribute data and file permissions, etc.

 

cd: Change directory

cd [path relative / absolute path]

 

pwd: displays the current directory

(Print Working Directory)

-p: it shows the exact path, rather than using a connection (link) path

 

mkdir: create a new directory

-m: rights profile, direct configuration (not need to see the default permissions (umask))

-p: help you directly to the required directory (containing the parent directory) recursively create up

 

rmdir: delete an empty directory

-p: along with the previous [empty] directory is also deleted together

 

cp: copy files or directories

-a: the equivalent of -pdr

-d: If the source file for the property profile link (link file), then copy the link file attribute rather than the file itself

-f: to force (force) meaning, if the target file already exists and can not open, try once again to remove

-i: If the target when (destination) already exists, at the time coverage will be asked operates

-l: conduct video link (hard link) to create links to files rather than copy the file itself

-p: copy along with the attributes of the file, rather than using the default properties

-r: recursive continuous replication for copying directories

-s: Copy the file to be a symbolic link (symbolic link)] [shortcut file

-u: If the destination was upgraded destination older than the source

 

rm: Remove files or directories

-f: force, ignoring the file does not exist, a warning message will not appear

-i: interactive mode, before deleting the user will be asked whether the action

-r: recursive delete

 

mv: move files and directories, or modify the name

-f: force, if the target file already exists, do not ask direct coverage

-i: If the target file exists, asking to overwrite

-u: Several target file already exists, and the source will be relatively new upgrade (update)

 

Linux view the contents of the file:

cat: there the first line displays the file contents

-a: the equivalent of -vET integration options to list some special characters and not just a blank

-b: No reason to travel, do not blank line numbers for display, blank lines are not marked line number

-e: The end of the line break bytes $ displayed

-n: line number is listed, along with a blank line will have a line number is different from -b

-t: the [tab] key to ^ | display

-v: in some unseen special characters

 

tac: start from the last row of the display (cat inverted write)

Referring to cat

 

nl: time display, output line number

-b: Specifies the line number in the manner specified: two kinds

-ba: whether he is a blank line, also lists the line number (similar to cat -n)

-bt: If there are empty lines, which line do not empty list (default value) line number

-n: Representation listed line number: Three

-n ln: line number at the far left of the screen display:

-n rn: line number in the far right column of his own show, and do not add 0

-n rz: The line number in the far right column of his own show, and add 0

The number of bits occupied by the row number of fields: -w

 

more: show the file contents page by page

Space: down one page

Enter: scroll down one line

/ String: in this content displayed among the search down [string]

f: immediately shows the file name and line number currently displayed

q: representatives immediately leave more, does not display the contents of the file

b or [Ctrl] + b: back flip, but only useful for files, useless for pipeline

 

less: the more similar, but better than the more that can flip forward

Space: turning down a

[Pagedown]: turn down a

[Pageup]: turn up one page

/ String: Search down [string]

? String: Search up [string]

n: repetition before a search

n: a hatred of the rich before the repercussions search

q: leave

 

head: just look at the first few lines

-n: followed by a number, display 10 lines by default the first few lines

 

tail: just look at the end of lines

-n: followed by a number, display a few lines

-f: continuously monitors the file name of the connected back until the [ctrl] -c will end tail detection

Guess you like

Origin www.cnblogs.com/heixiang/p/10983776.html