1. Cat: Used to connect files and print to standard output devices. (Usage rights: all users)
Syntax format:cat [-abeensttuv] [--help] [--version] fileName
parameter Description:
-N or--number: Numbers the number of rows for all outputs starting from 1.
-B or--number-nonblank: Similar to-n, except that blank lines are not numbered.
-S or--squeeze-blank: a blank line that is substituted for a row when it encounters a blank line that has more than two consecutive lines.
-V or--show-nonprinting: Use the ^ and m symbols, except for LFD and TAB.
-E or--show-ends: Displays $ at the end of each line.
-T or--show-tabs: Displays the TAB character as ^i.
-e: Equivalent to-ve.
-A,--show-all: equivalent to-vet.
-E: Equivalent to "-ve" option;
-T: equivalent to the "-vt" option;
Example:
Cat-n text1.txt text2.txt > Text.txt//Add the contents of Text1 and Text2 to the text document after adding a line number to the document
Cat/dev/null > Test.txt//emptying Test.txt document contents
2, Chmod:linux/unix file call permissions are divided into three levels: file owners, groups, and other. The use of chmod can be used to control how files are called by others. (Usage rights: all users)
Syntax format:chmod [-CFVR] [--help] [--version] mode file ...
parameter Description
Mode: Permission set string, in the following format:
[Ugoa ...] [[+-=][rwxx] ...] [,...]
which
U represents the owner of the file, and G indicates that the owner of the file belongs to the same group (group), and O means the other person, and a means that all three are.
+ indicates an increase in permissions,-represents a cancellation permission, = Represents a unique set of permissions.
R means readable, w means writable, x is executable, x means only if the file is a subdirectory, or the file has been set to executable.
Additional parameter Description:
-C: If the file permission has changed, it will not show its change action
-F: Do not display an error message if the file permissions cannot be changed
-V: Show details of permission changes
-r: The same permissions change for all files in the current directory as subdirectories (that is, they are changed in a recursive manner)
--HELP: Show Auxiliary Instructions
--version: Display version
Example:
chmod Ugo+r file1. TXT//Set the file File1.txt to all people can read chmod a+r file1. TXT
chmod ug+w,o-w file1. TXT file2. TXT//Files File1.txt and File2.txt are set to the owner of the file, and the same group as the person to which they belong can be written, but not others
chmod u +x ex1. PY//ex1.py is set to only the owner of the file can perform
chmod -R a+r *//Set All files and subdirectories in the current directory to be readable by anyone
In addition chmod can also use numbers to represent permissions such as:
777 File
The syntax is:chmod ABC file ( where A,b,c is a number that represents the permissions of user, Group, and other respectively.) )
R=4,w=2,x=1
- To rwx the attribute then 4+2+1=7;
- To rw-the attribute then 4+2=6;
- To r-x the property, 4+1=5.
chmod a=rwx file and 777 file have the same effect
chmod ug=rwx,o=x file and 771 file Same effect
3. CD: Used to switch the current working directory to DirName
Example:
cd /usr/bin//Jump to/usr/bin/
CD ~//Jump to your home directory
CD .. /.. Jump to the top two of the current directory
Linux Common Command Anatomy of learning notes-CAT/CHMOD/CD