http://blog.9cbs.net/onefish/archive/2004/12/22/225074.aspx
The Linux system information is stored in the file, and the file is similar to the ordinary official document. Each file has its own name, content, storage address, and some other management information, such as the user, the size of the file, etc. The file can be a letter, a address book, or a source statement of the program, the data of the program, can even include executable programs and other non-text content. The Linux file system has a good structure, and the system provides a lot of file handler. Here mainly introduces the commonly used file processing commands. File 1. The role of the file is determined by the probe file content, using the right to use all users. 2. Format File [Options] file name 3. [options] Main parameters - V: Display version information after the standard output, and exit. -z: Detect the compressed file type. -L: Allows connection. -f name: Read the list of files to be analyzed from the file namefile. 4. Brief Description Use the file command to know that a file is the executable of binary (ELF format), or the shell script file, or other format. FILE can identify file types with directory, shell scripts, English text, binary executables, C language source files, text files, DOS executables. 5. Application example If we see a file GRAP with a suffix, you can use the following command: $ file grap grap: english text At this time, this is an English text file. It should be noted that the file command cannot detect multimedia file types such as graphics, audio, and video. MKDIR 1. The role of the mkdir command is to establish a subdirectory named DIRNAME, similar to the MD command under MS DOS, which is all users. 2. Format MKDIR [Options] Directory Name 3. [Options] Main parameters - M, --Mode = mode: Set permissions
3. Main parameters [options] Main parameters: -c: Only the count of matched rows is output. -I: Does not vary in cases (only for single characters). -H: The file name is not displayed when querying multi-files. -L: You only output file names that contain match characters when querying multi-files. -N: Display matching row and line number. -S: Do not display error messages that do not exist or have no text. -V: Displays all rows that do not contain matching text. Pattern Regular Expression Main parameters: /: Ignore the original meaning of special characters in the regular expression. ^: Match the start of the regular expression. $: Match the end line of the regular expression. / <: From the row of matching regular expressions. />: The row of the matching regular expression is over. []: Single character, such as [a], is a conformity. [-]: Range, such as [A-Z], that is, A, B, and C, until Z is compliant. . : All single characters. *: There is a character, the length can be 0. Regular expressions are very important concepts in the Linux / UNIX system. Regular expression (also known as "regex" or "regexp") is a pattern that can describe a class of strings (Pattern). If a string can be described in a regular expression, we say this character and the regular expression match (Match). This and DOS users can use wildcard "*" to represent any character. On Linux systems, regular expressions are often used to find text mode, and the text execute "Search-Replace" operation and other functions. 4. Application instance query DNS service is one of the daily work, which means maintaining a large number of IP addresses overwriting different networks. Sometimes IP address will exceed 2,000. If you want to view the Nnn.nnn network address, but I forgot the rest of the second part, I only know that there are two periods, such as NNN NN ... To extract all NNN.NNN IP addresses, use [0-9] / {3 / }/ .[0-0/ }/. The meaning is that any number appears 3 times, then follow the sentence, then the arbitrary number appears 3 times, then follow the sentence. $ GREP '[0-9] / {3 / }/.[0-0/ {3/On }/' ipfile supplementary description, the GREP family also includes FGREP and EGREP. FGREP is FIX GREP, allowing a string instead of a mode; EGREP is extended GREP, supports basic and extended regular expressions, but does not support / Q mode scope and some more specifications corresponding to it. DD 1. The action DD command is used to copy the file and convert the data and format data according to the parameters. 2. Format DD [options] 3. [OPitions] Main parameters BS = byte: Forced IBS =
SEEK = Block Number: Skate the output data of the specified
(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 mixed lookup method. Find / etc -Size 1 500000c -and -mtime 1 mv 1. The action mv command is used to change the file or directory, or transfer the file from a directory into another directory, its usage authority is all users. This command is like a combination of REN and MOVE in the DOS command. 2. Format MV [Options] Source file or directory target file or directory 3. [Options] Main parameters -i: interactive operation. If the MV operation will result in overwrite the existing target file, the system is inquiry to override, requiring the user to answer "Y" or "n", which avoids erroneous overwriting files. -F: interactive operation is prohibited. The MV operation does not give any indication when an existing target file is covered, and the i parameter will no longer work after specifying this parameter. 4. Application example (1) Move all files in / usr / cbu to the current directory (use ": $ mv / usr / cbu / *. (2) Rename the file CJH.txt Rename WJZ .txt: $ mv cjh.txt wjz.txt ls 1. The role ls command is used to display the directory content, similar to the DIR command under DOS, and its use right is all users. 2. Format ls [options] [filename] 3.Options Main parameters -a, --all: Do not hide any items starting with "." Characters. -A, - Almost-all: Any item other than "." And ".." is listed. --Author: Prints each document authority. -B, -, --escape: The unprintable character is represented by an octa binary overflow sequence. - Block-size = Size: Blocks in bytes specified
-I, --ignore = style: No items that match the Shell Wan Character