Linux common command

xiaoxiao2021-03-06  107

http://blog.yiz.name Thread View Commands PS PS - EF | GREP View Keyword Kill Process Kill Kill -9 Process No. -9 Force Kill Process Find Command Find Find Command Used to find files. This command can be searched by file name, establish or modify the date, the owner (usually a user who creates files), file length or file type. The basic structure of the Find command is as follows: $ find specifies which directory start search. Specify search criteria. It means how to find a file. In general, use -Print action to display the entire file path and name. If there is no action, the Find command performs the search and does not display the result, equal to white feet. For example, to search for all the files on the system, you can use the following command: $ find / -name ye -print This can display all the files on the system on the system can also be fuzzy: find grep View keyword find command Several methods of finding files: (1) Find, for example, file name, for example, we want to find a file name is file name is file name is file name, you can use the following command: "/" after the Find / -Name Lilo.conf Find command Search the entire hard drive. (2) Quick Find Files Find files according to file names will encounter a practical problem, which is a long period of time, especially the large Linux file system and massive hard drive files are placed in a deep subdirectory. If we know that this file is stored in a certain directory, you can save a lot of time as long as you find it under this directory. For example, the SMB.conf file, from its file suffix ".conf" can determine that this is a configuration file, then it should be in the / etc directory, you can use the following command: find / etc -name smb.conf, use "Quick Find File" mode can shorten the time. (3) Finding method according to some file name Sometimes we know that only files contain 4 words, then find all files containing these 4 characters in the system, you can enter the following command: Find / -Name '* Abvd * 'Enter this command, the Linux system will find all files containing 4 characters contained in the / directory (where * are wildcards), such as AbvDrmyz, etc., can be displayed. (4) Use the mixed lookup method to find the file Find command to use a mixed lookup method, for example, we want to find more than 50,000 bytes in the / etc directory, and a file modified within 24 hours, you can use -and ( And) link two lookup parameters together into a Find / etc -size 500000c -and -mtime 1 Switch User Command SU Commonly switched between different users Switch SU ROOT display user current directory PWD

The path transform CD cd command not only displays the current state, but also changes the current state, which is basically consistent with the CD command under DOS. Cd .. You can enter the previous directory CD - can enter the previously entering directory CD ~ can enter the user's Home directory

Compressed decompression new TAR can directly access and establish Gzip compressed TAR files, as long as the z option is added in the tar command. For example: $ TAR CZVF Ye.tar * .txt Generates Compressed Archive Ye.tar.gz, $ TAR TZVF Ye.tar * .txt Displays the contents of the compressed file Ye.Tar.gz, and $ tar xzvf ye.tar * .txt Remove the contents of the compressed archive Ye.Tar.gz. Mkdir This command is simple, with DOS's MD command usage, used to establish a directory.

The CP CP command is used to copy files or directories. The CP command can copy multiple files at once, for example: $ cp * .txt * .doc * .bak / home extension the current directory to TXT, DOC, and BAK all copied to the / home directory. If you want to copy the entire directory and all the subdirectories, you can use the CP -R command.

The RM RM command is used to delete a file or directory. The RM command will force the file that can be used if you want to confirm when you want to confirm it, you can use the RM -I command. If you want to delete a directory, use the RM -R command. The RM -R command is deleted when the directory is deleted, and the prompt will be displayed every file or directory. If the directory is too large, the response is unrealistic. At this point, you can use the RM-RF command to force the directory so that the -i flag is used to handle it.

The mv mv command is used to move files and renamers. For example: $ mv Ye.txt / Home Moves the Ye.txt file in the current directory to the / home directory, $ mv ye.txt ye1.txt Remove the Ye.txt file to Ye1.txt. Similar to the CP command, the mv command can also move multiple files at a time, which is no longer repeated. Cat 1. Action CAT ("Concatenate" command is used to connect and display information about the specified one and multiple files, which is all users. 2. Format CAT [options] file 1 file 2 ... 3. [options] Main parameters - N: The number of line numbers of all outputs starting from the first row. -B: and -n are similar, but it is not numbered for blank lines. -S: When there is a blank row with two consecutive lines, it is changed to a blank line of a line. 4. Application example (1) CAT command A simplest use is the content of the display text file. For example, we want to look at the contents of the Readme file in the command line, you can use the command: $ Cat Readme (2) Sometimes you need to process several files into a file and save the results of this process to a separate output file. The CAT command accepts one or more files on its input and prints them as a separate file to its output. For example, after adding the contents of Readme and Install (not adding), attach the content to a new text file File1: $ Cat Readme Install File1 (3) Cat There is an important function to go to The number is performed, see Figure 2. This feature is for program documents, as well as the preparation of legal and scientific documents, printing the line number on the left makes a part of the reference document becomes easy, these are programming, scientific research, business reports, even legislative work is very important. The number function is performed on the line with -b (number of non-blank lines) and -n (can be numbered all rows): $ cat -b /etc/named.conf ln 1. Active ln command Create a link between files, which is all users. 2. Format ln [options] Source File [Link Name] 3. Parameters -F: The source file is removed first when the link is connected. -D: Allows system managers hard link to their own directory. -S: Symbolic Link. -B: The file that will be overwritten or deleted during the link. There are two links, one is called hard link, and the other is called a symbolic link. By default, the ln command produces a hard link. The hard connection refers to the connection through an index node. In Linux's file system, the file saved in the disk partition is no matter what type is assigned a number, called the index node (inode index). In Linux, multiple file names are existing to the same index node. Generally, this connection is hard connection. The hard connection is to allow a file to have multiple valid path names so that users can establish a hard connection to important files to prevent "erroneous deletion". The reason is as described above because there is more than one connection to the index node that should be directed. Only delete a connection does not affect the index node itself and other connections, only when the last connection is deleted, the file data block and directory connection will be released. That is, the file will be truly deleted.

转载请注明原文地址:https://www.9cbs.com/read-101148.html

New Post(0)