Name: CAT Use Permissions: All users use mode: cat [-abeensttuv] [--help] [--Version] filename Description: Connect the file to the basic output (screen or plus> filename to another) Parameters: -N or --Number is similar to the number of rows numbers -b or -number-nonblank and -n of all outputs, but it is encountered for blank lines - Square On two consecutive rows of blank lines, it is changed to the blank line of the line -V or -Show-nonprinting
Example: cat -n textfile1> textfile2 Plus TextFile1 files After adding the line number, enter the textfile2. Cat -b textfile1 textfile2 >> TextFile3 adds the file content of TextFile1 and TextFile2 to add the line number (blank line does not add) TEXTFILE3
Name: CD Usage Permissions: All users
How to use: CD [DIRNAME]
Description: Transform work catalog to Dirname. The DiRName representation can be an absolute path or relative path. If the directory name is omitted, transform to the user's Home Directory (that is, the directory where Login is located).
In addition, "~" is also expressed as HOME DIRECTORY, "." Means the current directory, ".." indicates the current directory of the current directory location.
Example: Jump to / usr / bin /: cd / usr / bin
Jump to your own home directory: CD ~
Jump to the upper two layers of the current directory: cd ../ ..
Directive Name: CHMOD Usage Permissions: All users
How to use: chmod [-cfvr] [--help] [--version] mode file ...
Description: Linux / UNIX file access rights are divided into three levels: file owners, groups, others. Using CHMOD how to control the file is accessed by others.
Tie count:
Mode: Permissions Set strings, formats are as follows: [Ugoa ...] [[ - =] [RWXX] ...] [, ...], where u indicates the owner of the file, G represents The owner of the file belongs to the same group (group), o represents the other people, and a means that these are all. Represents increased permissions, indicates cancellation, = indicates unique setting permissions. R indicates that readable, W represents written, x represents executable, X represents only when the file is a subdirectory or the file has been set to be executed. -c: If this file authority does have changed, it is displayed in the change action -f: If this file authority cannot be changed, do not display the error message-V: Display permission change - R: All files in current directory Permissions change with the subdirectory (ie, changed one by one by hand) - Help: Display Auxiliary Description --Version: Display version
Example: Set the file file1.txt to all people can read: chmod ugo r file1.txt
Setting the file file1.txt to be read: chmod a r file1.txt
Set the file file1.txt and file2.txt to this file owner, with its own same group of groups, but other people cannot write: Chmod Ug W, O-W File1.txt file2.txt
Set an ex1.py to only the file owner can be executed: chmod u x ex1.py
Set all the files and subdirectories in the current directory to anyone can read: ChMOD -R A R * Also CHMOD can also use the number to indicate that the authority of the CHMOD 777 File is: Chmod ABC file
Where A, B, C are each number, which represents USER, Group, and Other permissions.
R = 4, w = 2, x = 1 To RWX attribute 4 2 1 = 7; to RW-attribute 4 2 = 6; if the R-X property is 4 1 = 7.
Example: chmod a = rwx file
CHMOD 777 File
Effects the same chmod ug = rwx, o = x file
CHMOD 771 FILE
Effect
If you use CHMOD 4755 FileName, this program has root permissions
Directive Name: Chown Use Permissions: root
How to use: chmod [-cfhvr] [--help] [--version] user [: group] file ...
Description: Linux / UNIX is multi-person multi-work industry, all of which have owners. Use Chown to change the owners of the file. In general, this instruction only is used by the system administrator (root), and the general user has no permissions to change someone else's file owner, and there is no permission to change the owner of its own files to others. Only the system administrator (root) has such permissions.
Tie count:
User: New Archive owner's user IDGroup: New Archive owner's User Group (Group) -c: If the file owner does have changed, the change action is displayed - F: If the owner cannot Do not display the error message - H: only for links (LINK), not the LINK, true pointing file -V: Display owner change - R: All files and subdirectories in current directory Perform the same owner change (ie, changed one by one by way) - Help: Display Auxiliary Description --Version: Display version
Example: Set the owner of the file file1.txt to the User Group User Jessie: Chown Jessie: Users File1.txt
Use all files in the current directory with the owner of the subdirectory to users of users Lamport: chmod -r Lamport: Users *
Name: CP Use Permissions: All users
Use mode:
CP [options] Source destCP [options] Source ... Directory
Description: Copy a file to another, or copy several files to another directory.
Put on
-a will copy the file status, permissions and other materials as much as possible. -r If the Source contains a directory name, the files in the directory are also copied to the destination. -f If the destination already has the same file, it is deleted before the replication is removed. Example: Copy the file aaa (already existing) and name BBB: CP AAA BBB
Copy all C language to the finished subdirectory: cp * .c finished
Name: CUT
Use permission: All users
Usage: cut-cnum1-num2 filename
Description: Shows the text that counts Num1 to Num2 from the beginning.
example:
Shell >> Cat Examplest2this is test1shell >> Cut -c0-6 example ## print counts the first 6 words Test2this i
Name: Find usage: Find instructions:
List of files that comply with Expression in the archive system. You can refer to a combination of different information such as the name, category, time, size, permissions, etc., only fully matched. Find determines the Path and Expression on the following rules, first on the command - (), the previous part is PATH, after which is Expression. If PATH is a empty string, use the current path, if expression is the empty string, use -print as the preset expression
There are more than two or thirty options that can be used in Expression, which only introduces the most commonly used part.
-mount, -XDEV: Only check and specify files under the same archive system, avoid listing files in other file systems - Amin N: Reads in the past N - Annewer File: More than file file Night-read file -Atime N: Files read in the past N: CMIN N: Changed in the past N: -cnewer file: file updated than file file - CTIME N: in the past N Sky-modified file -empty: empty file -gid n or -group name: GID is n or group name is Name-ipath p, -path P: path name complies with P's file, IPath will ignore the case - Name name, -iname name: The file name is compliant with the file. INAME ignores uppercase-size N: The file size is n unit, b represents the block of 512-bit yuan group, c represents the number of words, and K means kilo bytes, W is two bit groups. -type C: The file type is C file. D: Directory C: Documentary Device Archives B: Block Device Archive P: Total Famous F: General Archive L: Symbol Connection S: SOCKET-PID N: Process ID is N
You can use () to separate the arithmetic, and use the following operations. Exp1 -and Exp2! EXPR-NOT Exprexp1 -or Exp2exp1, Exp2 Example: List of all extended files in the current directory and its subdirectory is C. # Find. -name "* .c"
List all the general files in its underlying directory therefrom # find. -Ftype f
List of all files updated in the current directory and its subdirectory # Find. -Ctime -20
Name: Less
Use permission: All users
Use mode:
Less [option] FileName
Description: The role of Less is very similar to more, can be used to browse the text file, the difference is that the LESS allows the user to scroll back to browse the already seen part, and because the Less does not read at the beginning The entire file, so when you encounter a large file, it will be fast than the general instrument editor (such as VI).
example:
Directive Name: LN Use Permissions: All users
How to use: ln [options] Source Dist, where Option is:
[-bdfinsvf] [-S backup-suffix] [-v {numbered, existing, simple}] [- help] [--Version] [-] Instructions: Linux / UNIX file system, so-called linking ( LINK, we can treat it as an alias of the file, and the link can be divided into two types: hard links and soft links, hard links means that a file can have multiple names, and The soft connection method is to generate a special file, and the content of the file is to point to another file. Hard links are in the same archive system, while soft links can span different archive systems. The LN Source Dist is a link (dist) to SOURCE, as for the use of the hard link or soft link, is determined by the parameter. Whether it is a hard link or soft link, it will not copy a copy of the original file, and will only take a very small amount of disk space.
-f: The file will first delete the file with the DIST: Allow the system administrator hard link to your directory -i: When deleting the file with the DIST, I'm inquiry -N: In progress When the soft link, the Dist is treated as a general file-S: Symbolic link -V: The file name is displayed before the connection - B: Backup of files that will overwrite or deleted during the link - S Suffix: Plus the backup files with the word tail - V Method: Specify the way backup - Help: Display auxiliary instructions --Version: Display version: ZZLN-S Yy ZZ
Generate a Hard Link: ZZLN YY XX with the file yy
Name: Locate Usage Permissions: All users use mode: locate [-q] [-d] [--Database =] locate [-r] [--Regexp =] locate [-qv] [-o] [- Output =] locate [-e] [-f] <[- l] [-c] <[- u] [-u]> locate [-VH] [--Version] [--help] Description: Locate let Users can quickly search for the specified file in the archive system. Its method is to build a database including all file names and paths in the system, and then only query this database when looking for, without having to go deep into the archive system.
In a general distribution, the establishment of the database is placed automatically in the contab. General users use as long as used
# locate your_file_name
The model is OK. Parameters: -U-U
Establish a database, -U will start by the root directory, and -U can specify the starting location.
-e
Will exclude the range of findings.
-l if it is 1. Start safe mode. In safe mode, the user will not see the file that is not available. This will slow down because Locate must obtain the permission information of the file in the actual archive system.
-f Examples of specific archives systems, for example, we have not to put the files in the proc archive system in the database.
-q quiet mode does not display any error messages.
-N is displayed to display an output.
-r Use a regular arithmetic condition for the condition.
-o Specifies the name of the stock.
-d
Specify the path to the database
-h display auxiliary message
-v Show more messages
-V display version of the version of the message:
LOCATE chDRV: Looking for all files called ChDRV locate -n 100 a.out: Look for all files called A.out, but only 100 locate -u: Establish a database
Name: LS Use Permissions: All users
How to use: ls [-ALRTAFR] [name ...]
Description: Displays the contents of the specified working directory (list the files and subdirectories included in the current working directory). -A Displays all files and directories (LS instead of starting the archive name or directory name "." is considered hidden file, not listed) -L In addition to the file name, file type, permissions, owner, The size of the file is detailed -R -R to display the file in the opposite order (original alphabetical order) -t list -A -A-A, but not listed "." (Current) Directory) and ".." (parent directory) -f plus a symbol after listed; for example, the executable is added "*", the directory is added "/" - r If there is a file in the directory, the following The archives are also listed sequentially
Example: List all the names in the current working directory, the beginning of the beginning, the getting upset behind: ls -ltr s *
List all directories and file details below / bin directory: ls -lr / bin
List all files and directories in the current work directory; directory is then added "/", and the file can be executed after the name is added "*": ls -af
Name: More Use Permissions: All users use methods: more [-dlfpcsu] [-num] [ / pattern] [ LINENUM] [filenames ..] Description: Similar to CAT, it will be convenient in one page The user is reading page by page, and the most basic instruction is to press the blank key (Space) to display the next page, press the B button to come back (back) one page, and there is also the function of searching strings (with VI Similarly, in use, press H. Parameters: -Num The number of rows -D prompt users, display [Press Space to Continue, Q to Quit.] Below the screen, if the user presses the wrong button, [Press H for instructions.] Instead of Beep-L cancels the number of function -f calculating rows when the special font ^ L (paper feed character) is met, the number of rows after the actual line, not the number of rows after the automatic wrap (some single line words It will be extended to two rows or more.) -P does not display each page in a row, but first cleared the screen, then display the content-C and -p, the difference is to display the content and then clear other Old Data-S When there is a blank line with two consecutive lines, the blank line-U does not display the lower quotation marks (depending on the TERMINAL specified by the environment variable TERM) / in each file display Search for the string (Pattern), then start displaying from the string NUM Start displaying filenames from the NUM row to display files to display the contents of the content, can be used as a number of quotable examples: more -s testfile Displays the file content of Testfile If there are two consecutive lines of blank lines display in a row of blank lines. More 20 Testfile starts the contents of Testfile from the 20th line.
Name: MV Use Permissions: All users
Use mode:
MV [Options] Source Destmv [Options] Source ... Directory Description: Move a file to another, or move several files to another directory. Parameters: -i If the destination already has the same name file, first ask if the old file is overwritten.
example:
Rename the file AAA to BBB: MV AAA BBB
Move all C language programs to the finished subdirectory: mv -i * .c Name: RM Use Permissions: All users
How to use: rm [options] name ...
Description: Delete files and directories.
Put on
-i before the deletion, please ask for confirmation one by one. -f even if the original file property is set to read, it is also directly deleted without one by one. -r Detects the directory and below. Example: Delete all C language program files; ask for a one before deleting confirmation: rm -i * .c
Remove all files in the Finished subdirectory and subdirectory: RM -R Finished
Name: RMDIR Use Permissions: All users with appropriate permissions in current directory
How to use: rmdir [-p] DIRNAME
Description: Delete empty directories.
Parameters: -P is that when the subdirector is deleted, it will also be deleted by the way.
example:
Remove the subdirectory named AAA in the working directory: RMDIR AAA
In the BBB directory in the working directory, delete the subdirectory called TEST. If the Test is deleted, the BBB directory is empty, then BBB is also deleted. RMDIR -P BBB / TEST
Name: SPLIT Use Permissions: All users
How to use: split [option] [INPUT [prefix]]
Description:
Split a file into several files. From the INPUT division output into a fixed-size file, its file name is prefixaa, prefixab ...; prefix preset value `x. If there is no input file or `-, you will be read from the standard input.
匡 兜
-b, --Bytes = Size
The size value is the size of each output file, and the unit is BYTE. -C, --Line-bytes = size
In each output, the maximum number of BYTEs in a single line. -L, --Lines = Number
The Number value is the size of the column size of each output. -Number
The same as -l Number. --Verbose
Print the detection information to standard error output before each output file is opened. --help
Display auxiliary information and then leave. --Version
Listed by this information and then leave. Size can join the unit: b represents 512, K represents 1k, M represents 1 meg.
example:
Postgressql Large Data Library Backup and Recycling:
Because Postgres allows the form to have a largest capacity of your system file, it is possible to have problems with table dump to a single file, and Split is used to divide.
% PG_Dump DBNAME | SPLIT -B 1M - FileName.dump.
Reload
% createDb dbname% cat filename.dump. * | PGSQL DBNAME
Name: Touch Use Permissions: All users
How to use: Touch [-ACFM] [- r Reference-file] [--file = reference-file] [- t mmddhhmm [[cc] yy] [. Ss]] [- D Time] [--DATE = TIME ] [- Time = {Atime, Access, Use, Mtime, Modify}] [- no-create] [--help] [--version] file1 [file2 ...]
Description: Touch instruction changes the time record of the file. LS -L can display the time record of the file.
Parameters: a Changing the read time record of the file. m change the modification time record of the file. C If the purpose file does not exist, it will not establish a new file. Like -No-Create. F is not used, is to retain to compatibility with other UNIX systems. r Use the reference file time record, like the effect of thefile. D Setting time and date, you can use a variety of different formats. T Time Record of the file is set, the format is the same as the DATE instruction. --NO-CREATE does not establish a new file. --Help lists the instruction format. --Version lists this message. example:
The simplest way of use, change the file when you record the time. If the file does not exist, a new file will be established.
Touch filetouch file1 file2
Change the time record of File to 18:3:39 on May 6, 2,000 years. Time format can refer to the Date directive, at least you need to enter MMDDHHMM, which is the time of months and minutes.
Touch-C -T 05061803 FileTouch -c -t 050618032000 file
Change the File time record into ReferenceFile.
Touch -R ReferenceFile File
The time record of File is changed to 18:3:36 on May 6, two thousand years old. Time can be used in AM, PM or 24-hour format, and other formats can be used in other formats such as 6 May 2000.