Linux Directive Daquan (1)

zhaozj2021-02-11  189

Linux Directive Daquan (1)

CAT CD CHMOD Chown CP CUT Name: CAT Usage Permissions: All users use methods: cat [-abeensttuv] [--help] [--Version] filename Description: Connect the file to the basic output (screen or plus> Filename to another file) Parameters: -n or --Number starts with the number of rows numbers -b or -number-nonblank and -n of all outputs, but not numbered for blank lines -S or -SQUEEZE -BLANK encounters a blank line with two consecutive lines, it is changed to a row of blank line -V or --Show-nonprinting example: cat -n textfile1> textfile2 adds textFile1 file content After adding textfile2 File Cat -b TextFile1 TextFile2 >> TextFile3 adds the file number of TextFile1 and TextFile2 (blank line does not add), attached to the textFile3 name: CD Use Permissions: All users use mode: 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 jumps to its own home Directory: CD ~ Skip to the current two layers of the current directory: CD ../ .. instruction 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. Putting: Mode: Permissions Set strings, formats are as follows: [Ugoa ...] [[ - =] [rwxx] ...] [, ...], where u indicates the owner of the file, g Indicates that the owner of the file belongs to the same group (Group), o represents people other than 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 (that is, changed by a manual way) - HELP: Display auxiliary instructions --Version: Display version example: Set file file1.txt to everyone can read: chmod ugo R file1.txt Sets the file file1.txt to be read: chmod a r file1.txt Sets file file1.txt and file2.txt owner, with its own same group can write However, others cannot be written: Chmod Ug W, OW file1.txt file2.txt Sets EX1.py to only this file owner can be executed: chmod u x ex1.py will be in current directory All archives and subdirectories are available to anyone: ChMOD -R A R * Also CHMOD can also use numbers to indicate rights such as CHMOD 777 File syntax: chmod abc files, B, C each as a number The permissions of User, Group, and Other, respectively. 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 and chmod 777 File effect The same CHMOD UG = RWX, o = x file and chmod 771 File effect The same uses CHMOD 4755 filename to make this program with root permission command name: chown use permission: root use Method: chmod [-cfhvr] [--help] [--Version] User [: group] file ... Description: Linux / UNIX is multi-person multi-work system, 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. Teltering: User: User IDGroup: New Archive owner's User Group (Group) -c: If this file owner does change, it displays its change action -F: if this file The owner cannot be changed or the error message is not displayed - h: only for the link (LINK), not the LINK true pointing file -V: Details of the owner change - R: All files in current directory Make the same owner change with the subdirectory (ie, changed one by one by one) - Help: Display auxiliary instructions --Version: Display version example: Set the owner of the file file1.txt User Jessie : Chown Jessie: Users file1.txt All files in the current directory with the owner of the subdirectory of the subscriber Lamport: chmod -r lamport: users * Name: CP Usage Permissions: All users use: CP [Options] Source Dest CP [Options] Source ... Directory Description: Copy a file to another, or copy several files to another directory. Put the status of the file status, permissions as much as possible, etc. -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 copies all C language to the finished subdirectory: CP * .c finished Name: CUT Usage Permissions: All User Usage: CUT - CNUM1-NUM2 FILENAME Description: Shows the text that counts Num1 to Num2 from the beginning. Example: Shell >> Cat Example Test2 this is test1 shell >> Cut -c0-6 example ## print 200 Test2 THIS I Name: Find Usage: Find User Description: Combine Expression in the archive system The file is listed. 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 null string, use the current path, if Expression is a empty string, using -print to use the options you can use in the Expression (Expression) for more than twenty or thirty, here only the most common part is described. -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 ignores case-write- 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: Dictionarized Device Archive B: Block Device Archive P: Total Site F: General Archive L: Symbol Connection S: Socket -Pid N: Process ID This file You can use () Separate the arithmetic And use the following operations. Exp1 -and Exp2! EXPR-NOT EXP1 -OR EXP2 EXP1, EXP2 Example: List of all extended files in the current directory and its subdirectory is C.

# Find. -name "* .c" lists all the general files in its underlying directory, lists the current directory and its subdirectory all the files updated in the current directory and its subdirectory. # Find . -ctime -20 Name: Less Use Permissions: All Users User: Less [option] FileName Description: LESS's role is very similar to more, can be used to browse the text file, the different is Less allows the user to go Roll back to browse some parties that have been seen, because LESS did not read the entire file at the beginning, so when you encounter a large file, it is fast than the general instrument editor (such as vi). Example: Directive Name: LN Use Permissions: All users use mode: ln [options] Source Dist, where Option is: [-BDFINSVF] [-S backup-suffix] [-V {numbered, existing, simple}] [--HELP] [--Version] [-] Description: In the Linux / UNIX file system, there is a so-called link, we can treat it as an alias of the file, and the link can be divided into two: Hard Link and Soft Tie (Symbolic Link), the hard link means that a file can have multiple names, while the soft link is to produce a special file, the content of the file is to another file. position. 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 - VMETHOD: Specify the way backup - HELP: Display Auxiliary Description --Version: Display version: Zs YY generates a Symbolic link: zz ln -s yy ZZ generates a Hard Link: ZZ LN YY XX Name: Locate User Permissions: Locate [-Q] [-d] [--database =] locate [-r] [--Regexp = ] Locate [-qv] [-o] [--output =] locate [-e] [-f] <[- l] [-c] <[- u] [-u]> locate [-VH] [ --Version] [--help] Description: Locate allows users to quickly search for specified files 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 can use the type of # locate your_file_name when using. Parameters: -u -u Establish a database, -U will start with the root directory, and -U can specify the starting position. -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 to specify the path of the database - H Display Auxiliary Message-V Display More News - V Display Program Version Message Example: Locate ChDRV: Find all files called ChDRV Locate -n 100 a.out: Look for all called A. OUT file, but only 100 Locate -u: Establishment Database Name: LS Use Permissions: All users use mode: ls [-alrtafr] [Name ...] Description: Display content under the specified work 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 "/" if there is a file in the directory, then the following The archives are also sequentially listed: List all the names of the beginning of the current work directory, and the more advances behind: ls -ltr s * list all directory and file details: LS -lr / bin lists all files and directories in current working directory; directory, add "/" after the name, can perform files After adding "*": LS -AF name: more Use Permissions: All users use methods: More [-dlfpcsu] [-num] [ / pattern] [ LineNum] [filenames ..] Description: Similar to CAT, but will make the user page-page reading with a page display, and the most basic instruction is Press the blank key (SPACE) to display the next page, press the BACK page to display, and there is also the function of the search string (similar to VI), use the instruction file, please 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. 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 methods: mv [options] Source Dest MV [options] Source ... Directory Description: Move a file to another file, 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: Move the file aaa to bbb: MV AAA BBB Moves all C language to the finished subdirectory: mv -i * .c Name: RM Use Permissions: All users use: rm [options] name .. Description: Delete files and directories. Ask the account to be deleted one by one to confirm 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 programming; before the deletion, check the confirmation: rm -i * .c Delete all files in the finished subdirectory and subdirectory: RM -R Finished Name: RMDIR Use Permissions: In the current directory, appropriate permissions All users use methods: 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: Delete the subdirectory named AAA in the working directory: RMDIR AAA deletes a subdirectory called Test in the BBB directory in the working directory. 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 use methods: split [option]]] Description: Split a file into several. 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.

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

New Post(0)