Lesson advanced directories and files operations
cat (output file contents all at once)
CAT -n filename line number
cat -b file name is not blank line line number
less (page display, can flip up and down, up and down cursor keys key, PageUp PageDown)
less -N file name display line numbers
tail (from the end of the file is displayed, the default is 10 lines)
tail - specify the file name shows how many digital lines
tail -f filename continued to display dynamic update file, l such as log content increased
head (from the beginning of the file is displayed, the default is 10 lines)
head - digital display file names specifies how many lines
ls (see the contents of the current directory)
LS -a show all files
ls -l displays detailed information about a file or directory
wildcard : allows the user to select the file name according to the character mode.
(1) wild card is processed by the shell
(2) role is to provide some special characters to help make quick or screening a set of file names
(3) with the file name associated command often use the wildcard ls find cp mv
character mode:
* matches any number of characters (zero or more)
? Match any single character (placeholders)
[] matches any character belonging to a character set
{} string matches any one of a set of strings belongs, among a string "," partition
created file or directory
touch a. txt (empty file)
b.txt vi
mkdir abc
mkdir -pa / ab / abc / ABCD
cp copy files, copy files or directories to where the requirements of the original file or directory exists, the target path exists
path can be an absolute path can also use relative paths
can copy more than at the same time a file or directory, wildcards can be used
under the same directory and is backed renaming
cp -p backup configuration files used to
replicate directory -R & lt CP
Music Videos cutting and pasting
the file to the same directory for mv f1 f2 is renaming
for folders or directory for mv d1 d2 operate under the same directory folder,
if there is no d2 is renamed, if there is d2, d1 is to cut to the next d2
soft links and hard links to
soft links are pointing to the file name, similar to Windows shortcuts
hard link pointing to the inode number of the file system, innode related to the physical address
command to find:
Which command is a command to find the existence of, and the storage location where the command
whereis command searches only binary files (parameter -b), man Description file (parameter -m) and source code files (parameter -s). If the parameter is omitted, all the information is returned.
xxd view binary
file viewer:
the Find is the most common and most powerful Find command. It can be done in real-time locate, pinpoint, but slower.
find [specified directory] [targeting criteria]
The -type
-name
-user
-group
-perm
-ctime -n -n + n is less than n days, + n is n days ago
-mtime
-atime
text keyword search:
grep text search is a powerful tool that use regular expressions to search text, and print out the matching rows
(1) to pay attention to keyword search case sensitive
(2) grep command supports regular expressions, regular expressions define matching rules, the wildcard function is similar, but the wildcard is shell supports.
(3) current need only be concerned with "^ abc" beginning with "abc $" to the end of the regular expression
(4) regular expression. Represent any one character, * means to repeat the previous character zero or more times as ooo * represents the string if it contains two or more o string
number matches the number of rows grep -c
grep -i case-insensitive
grep -n show line numbers match and the content
grep -v Invert
grep -F patten non-specified regular expression
content of the document statistics:
WC the -l / ECT / password file how many lines
wc -c / ect / password file how many bytes
to view the catalog space using
du -sh the size of files and directories
du -ah size of all files and directories
df -h disk space usage
delimited file:
Split -b numbers separated by file size
split -l numbers separated by number of lines in the file
merge file:
CAT abc * >> abc.txt
03- Linux directory and file Advanced Operation
Guess you like
Origin www.cnblogs.com/Chamberlain/p/10983433.html
Ranking