1. # indicates the permission user (for example, root), and $ indicates the normal user
Boot prompt: Login: Enter the user name
Password: the user enters the corresponding user environment after successfully logging on to the system.
Exit the current shell and enter exit.
2. useradd netseek Add a netseek user
Passwd netseek sets a password for the netseek user.
(/Etc/passwd/etc/group)
Userdel netseek Delete account
Userdel-r netseek deletes the account along with its own directory.
[For more detailed operations, see man page and account management]
3. View commands
Ls-l display file list
Ls-al-a displays all files and directories (ls indicates that files whose names or directories start with "." are regarded as hidden files and are not listed)
Ls-al | grep '^ d' display directory
Ls-al | grep '^ [^ d]' query all files in a directory that do not contain the Directory
Ls-sh (man ls view man help .)
Linux file types:
D indicates that this file is a directory.
-Indicates that this file is a common file.
B indicates that this file is a special block device I/O file.
C indicates that this file is a special character device I/O File
L indicates that this file is a connection file. The file name is followed by the file path and name connected to it
The file command determines the file type by detecting the file Content
4. create files and directories
Touch 1.txt
Cat> 2.txt (create a file with a ing character, enter the content, and press ctrl + d to save the content)
Mkdir mywork creates the mywork directory.
5. Copy files or directories
Cp filename1 filename2
Cp-r dir1 dir2 copy directory
The cp-rf parameter f is used to delete an existing target file without prompting
The cp-I parameter is opposite to the cp-I parameter f. A prompt is displayed before overwriting the target file, asking the user to confirm. The target file will be overwritten when the answer is y, which is an interactive copy.
6. delete files and directories (you can use rm to delete files or directories)
Rm 1.c // Delete the. c file.
Rm-rf (Force delete a file or directory. No prompt is displayed during deletion .)
7. Remove the directory or change the file name
Mv [opitons] source file or directory target file or directory
[Options] Main Parameters
-I: interactive operation. If the mv operation will overwrite the existing target file, the system will ask whether to rewrite the file and ask the user to answer "y" or "n ",
This avoids overwrite the file by mistake.
-F: Disable interactive operations. When an mv operation overwrites an existing target file, no indication is given. If this parameter is specified, the I parameter will no longer work.
Mv hello ../move the hello directory or file to the upper level.
8. alias
Alias dir = 'LS-l' input dir, which is equivalent to executing ls-l
9. Permission control (rwx 421)
Chmod + x hello. sh grant the executable permission.
(Details on permission control)
Chmod command permission modification usage: chmod one-digit octal number filename (rwx 421)
For example: chmod u + x filenmame, you only want to run it for yourself.
Chown netseek. netseek mydir Change User Group
U: indicates the file owner.
G: indicates the same group of users.
O: other users
A: indicates all users.
Opt indicates the operation, which can be:
+: Add a permission.
-: Cancel a permission.
=: Grant the given permissions and cancel the original permissions.
Mode indicates the permission:
R: readable 4
W: writable 2
X: executable 1