1./relative path, root directory
1.1 ~/equivalent to user directory/home/yourusername
2.CD/To root directory, Cd/dev directly to the Dev directory in the root directory
2.1 CD. Return to the upper directory, CD. Still the current directory
3. View your current directory pwd command
4. View the currently logged on user WhoAmI
5. View the information ID of the current user's group
6.ls viewing files under a folder
7. Mount the MOUNT/DEV/CDROM/MNT/CDR (mount point) and hang the CDROM in the MNT/CDR directory
7.1 Uninstalling Umount/dev/cdrom
8. Delete an empty folder RmDir TestDir (relative path or absolute path) to create a folder mkdir
9.exit Exit Terminal
10. Immediate shutdown Shutdown-h now restart Shutdown-r
11. Ask for help with man command or command
Clear Clear Screen
13.ls-l
Start with D is the folder, with-the beginning of the view file, the expression beginning with L is the soft link output information from left to right, including the file name, files type, permission mode, hard connection number, owner, group, file size and file last modified time, etc.
14.rm-r dir recursive (Recursive) Delete (can delete directories and files, more common than rmdir)
RM-RF dir recursive force recursive forced removal
15. Create a file Touch Demo.java
16.CP Demo.java Xx/demo2.java Copies the Demo.java under the current directory to the XX folder in the current directory, and is named Demo2.java MV Command Move command, similar to the CP usage, where the special case MV Demo.java dem O2.java Name the Demo.java file in the current folder as Demo2.java (rename)
17.VI Command mode, edit mode more with VI read file list to
18.cat Demo.java list File contents (positive order) TAC Demo.java list file contents (reverse) Head-2 Demo.java list The first two lines of a file
Tail-2 Demo.java List The following two lines of a file
19.find ~/-name Demo.java Find the Demo2.java file by name under the user directory (* for any character) get the absolute path of the file
Whereis ls (followed by a command) gives the path to the command file
21.ln is divided into hard link and soft connection two kinds, the default type is hard link, if need to create a soft link need to use the-s command soft link similar to the shortcut, since it is linked, the file must be related, the hard link file changed after the source file will be changed, if the original file is deleted after the hard link file is not deleted, Soft link file will expire (soft link is also called symbolic link)
sudo adduser testuser Add a user to the home folder next to one more user directory
In the final section of the/etc/passwd file there will be some information about the user that can be viewed using more/etc/passwd
sudo passwd testuser change password for user
23. View group information Add a user does not specify a group when the default to create a new user name of the same group, by executing in the ETC directory under the more group can be seen, generally newly added in the last side
You can also view the username by ID.
24. Change user's group sudo usermod-g selectedgroupname username sudo usermod-g selectedgroupname username Add user to this additional group
25. Delete User, Userdel username Delete user's file Rm-rf username (need to execute in home directory)
26. Switch to another user Su Useranme, direct su using the root account
27. When a new user logs on, the default directory is the current user's home directory ~/
28. File Permissions
-rw-r--r--the first delegate type is 9 bits after the file is divided into three groups (four permission types: R read,w write x excute-no permissions) The first represents the owner of the file, and the second group is the permissions of the other users in the same group as the file. The third group represents the rest of the other person's permissions on this file
chmod +x Demo.java for this file plus can execute permissions, (all users can execute!) )
Chmod-x Demo.java for this file minus on can execute permissions, (all users can execute!) )
chmod u+x Demo.java Add the executable permission for this file to the current user
chmod g+x Demo.java to the current user's group plus the executable permission for this file
chmod o+x Demo.java Add executable permissions for this file to users other than the current user's group
can also be modified in a way similar to chmod 777 chmod 7,552 Binary
29. Modify the file owner Chown root Demo.java
30.grep find the string in the specified text file grep s Demo.java find the line containing s in Demo.java
31. The pipeline transmits the output of one command to another command as input to another command
Use the method command 1| command 2| command 3
Example Ls-rl | More pagination display data, page by space
CAT/ETC/PASSWD |WC See how many lines there are in a file, how many words, how many characters
CAT/ETC/PASSWD |grep testuser View information only for TestUser
Ls-l |grep "^d" lists only folders
Ls-l |grep "^-" | Wc-l calculate how many files are used in a folder
32. Command Replacement Wall Date Notifies all users, resolves date to date command
REDIRECT the structure of the command back to a file
ls > Cmd.txt
LS >> cmd.txt
LS 2> cmd.txt C error redirect
Wall < Cmd.txt read into a file
Append the structure of the command to a file
How to modify the system's default boot level
Linux Common commands