Linux basic commands (3)
1 、 ln--link
Meaning: create a linked file
Format: ln [- s] source file... link file path
Add a symbolic link with the-s (create soft connection) option to point to the path of the original file
Note: the source file must be an absolute path equivalent to a "shortcut", also known as a soft connection.
2. Search tool which search tool
Format: which [- a] program name.
Whereis search tool
Format: whereis file name
Set up a location index library and execute the updatedb command (manually generate the database) default location: / var/lib/mlocate/mlocate.db
3. Locate positioning tool format: locate [options]... keyword common command options:
-I: ignore case when looking up
-r: use regular expressions when looking up
4. Find search tool format: find [look in] [search criteria] commonly used search criteria
-type: find by file type
F: ordinary files
D: directory
L: connect the file
B: block device file
C: character device file
-name: find by file name
-a: multiple conditions need to be met at the same time
-o: multiple conditions satisfy any one of them
-size: find by file size
-mtime: find other search criteria by file modification time
-user: search by the user to which the file belongs
-perm: search the permissions of the file
-axdepth: specify the directory depth to look up
/ / find all directories under directory / boot/
/ / find all the ordinary files under the directory / boot/
/ / find the file named tty1/tty2/tty3 under the directory / dev/
/ / find files larger than 2m under the directory / boot/
/ / find the files under the directory / boot/ whose names have begun with vm
Processing the file format found by find: find [range] [condition]-exec processing command {}\
Note: {}: replace each search result,\;: end of processing operation
/ / find all files larger than 2m under the directory / boot/ and display them in a long format
/ / find all files larger than 10m under the directory / boot/ and copy them to the directory / opt/
5 、 cat-Concatenate
Meaning: display file content format: cat [options] File name Common command options:
-n: displays the line number before each line (including blank lines)
/ / View the display information of the network card (display line number).
6. Intercept the head / tail of a file
Head, tail command
Format: head-n file name
Tail-n file name
Note: head/tail displays the first / last ten lines by default
/ / File / etx/passwd displays the first ten lines
/ / File / etx/passwd displays the last ten lines
/ / File / etx/passwd displays the first two lines (either of the following two representations is OK)
7 、 wc-Word Count
Meaning: digital statistics format of files: wc [options] File names Common Command options
-l: calculates the total number of lines of text
-w: count the number of words
-c: calculate the number of bytes in the file
-m: count the number of characters