Iii. Common commands for Linux
1. File Naming conventions
1) except/All characters are valid, the file name cannot contain/symbol
2) Some characters are best not used, such as spaces, tabs, backspace and characters @#$& ()
3) Avoid use. As the first character of a normal file, because. is the first character of a hidden file (must be mastered)
4) Case Sensitive
?
2. Command format
Command format: command-option parameter???? Separated by a space
Example: ls-la/etc
?
Description
1) When there are multiple options, it can be written together
2). Indicates the current directory,.. Represents the parent directory of the current directory
?
3. Detailed instructions
Commands that the root user can execute
/sbin
/usr/sbin
All user-executable instructions
/bin
/usr/bin
Bin-binary???? Usr-user???????? Sbin-super binary
?
3.1 File processing commands
1) LS
Drwxr-xr-x 2 root root 4096 12-01 20:52 bin
Linux
D: catalog file.
L: symbolic link ( point to another file , Similar to the shortcut under Windows )
S: socket file.
B: block device file , binary file.
C: character device file.
P: named pipe file.
-: ordinary file, or more precisely, not of the above several types of files. /span>
R-read read W-write write, x-execute execution
?
Owner (creator) U???? Owning Group G???????? Other People O
User???????? Group???? Other
?
2-Number of hard connections?
?
Root root
Owner-owned group
?
4096 size of file, approximate value
Block block default 512 bytes
?
12-01 20:52
When the file was created or the last modified time value
Bin
Filename
?
2) CD
3) PWD
4) Touch
5) mkdir
-P recursive creation of Mkdir-p Grandfather/father/son
6) CP
?
7) MV, cut and rename
8) RM, only one file can be deleted
-F no need to ask
RmDir Delete Empty directory
9) Cat
Show first after the TAC command
More pagination Display file
One) head
tail)
) ln
Plus-S is a soft link
Do not add a hard link
Soft links are similar to Windows shortcuts
Can soft links cross file systems?
?
Hardware link: cp-p (cp-p does not change the timestamp of the file) and real-time update, mapping, with the same inode as the original file
Hard links cannot cross file systems
?
Ls–i
I-inode I node, file I node
The Linux kernel handles anything that requires a digital marker.
?
3.2 Permission Handling commands
1) chmod
chmod u r
G W
o X
chmod u+wx chmod o-rx chmod g=rwx
?
Note: RWX does not have the same meaning for files and directories
Example: To delete a file, instead of having W permission on a file, you should have W permission on the directory where the file resides.
2) Chown must have root authority
Chown Game:game/etc/service
Useradd gaomin
passwd gaomin
3) Umask
Run Umask
0022
0 Special Permission Bits
022 user rights bit, permission mask value
777
-022
=755
/*********************/
Linux permissions rule: Files created by default cannot grant X permissions
To change permissions for a file created by default 750, you should use a mask value of 027 (777-750), Umask 027
2_linux_ file and permission handling commands