“This is the fifth day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”


1. Shutdown command

But normally, no shutdown is performed, and the server runs forever

Sync Synchronizes data to the hard diskCopy the code

2. Directory operation commands

lsList directory add-aParameter, display all files;-lParameter displays file properties and permissionscdSwitch directorypwdDisplay the current path mkdir creation directory-pParameter to recursively create multiple foldersrmdirDelete an empty directorycpCopy directories or filesrmRemove a file or directory-fParameter, no warning message will appear;-rParameter, recursively delete directory;-iParameter, is asked when deletingmvMove files or directories, or rename them-fParameter, force to move, the same name is overwritten;-iParameter, asked when overwritingCopy the code

3. Basic file properties

  • [d] indicates a directory
  • [-] is a file.
  • If [L], it is a link file.
  • If [b] represents a storage interface device (random access device) in the device file;
  • [c] indicates a serial port device in a device file, such as a keyboard or mouse (a one-time reader device).
  • The permission numbers for r, w, and x are 4,2,1

4. Modify file properties

  1. Change the file owner group
chgrp [-R] array name File name-RParameter, all files in the directory will be modifiedCopy the code
  1. Change the file owner
chown [-R] Owner name File nameCopy the code
  1. Change the read/write permission of a file
chmod [-R] 777File or directory7Is the highest permission-RParameter, again used to change the permissions of all files in the directoryCopy the code

5. View the file content

catDisplays file contents in positive order from the first line-nTac Displays the contents of the file from the last line. More Displays the contents of a page. Enter the next line. ? The character searches head up to look at the first few lines-n20According to the former20Line tail Looks at the last few linesCopy the code

6. Hard and soft links

Ln a.txt b.txt Create the hard link b ln of A-sCreate a soft connection for A (equivalent to a shortcut)Copy the code

7. Use of Vim

7.1 Three modes

  1. Command mode When we open Vim, we enter command mode
  2. Input mode We enter I in command mode to enter input mode
  3. Baseline command mode Enter colon: to enter the command :wq, save the configuration and exit

An exclamation mark is mandatory

8. Account management

  1. Add user
useradd -mThe user name-GUser groups-cAdd a comment describing the su user name used to switch userscat/etc/passwd Displays user records of system filesCopy the code
  1. Delete user
userdel -rThe user name-rParameter, along with the folder to deleteCopy the code
  1. Cryptographic operations
Under the root user password User name You can set a password for the user-lUser name lock A user can set a password for himself under common user passwordCopy the code

9. Manage user groups

  1. Adding a User Group
groupadd -gId number group nameCopy the code
  1. Deleting a User Group
Groupdel group nameCopy the code
  1. Modifying group Attributes
groupmod -g 133 -nGroup3 group1 Change the group number to133Change the group name to group3Copy the code

10. Three system files to know

/etc/passwd The following information is displayed for user management: auth:x:7:21:Authentication administrator:/tcb/files/auth:
1.starts with the username2The x below represents the encrypted password3. User ID4. Group ID5Annotation.6Home directory /etc/shadow Corresponds to the records in the password one by onegroupStore group informationCopy the code

11. Disk management

df -hLists overall disk usage and displays the file size of the current directory in the familiar byte du displayCopy the code

12. Process management

psDisplays the threads executing in the current systemps -aAll processes on the current terminal are displayedps -uDisplays the current user's processps -xDisplay background processesps -efDisplays information about all processes in the system-fParameter to display complete informationps -aux| grep mysql grep filtering is eligible string | pstree equivalent of pipes-pu

kill 9 -Process ID Forcibly ends a processCopy the code

Install JDK (RPM file)

Install the RPM-ivh jdk-8u221-linux-x64RPM uninstall RPM-e --nodeps jdk1.8.0_121- 1.8.0_121-fcsX86_64 Configure (/etc/profile) export JAVA_HOME=/usr/java/jdkjdk1.8.0_251-amd64
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Let new environment variables take effect!
source /etc/profile
Copy the code

14. Install Tomcat (compressed file)

Mobile directorymv apache-tomcat9 -.0.22.tar.gz /usr decompress tar-zxvf apache-tomcat9 -.0.22.tar.gz Starts./startup.sh Closes./shutdown.shCopy the code

15. Firewall ports

Check the firewall service status
systemctl status firewalld

# enable, restart, disable, firewalld. Service
# open
service firewalld start
# to restart
service firewalld restart
# close
service firewalld stop

# check firewall rules
firewall-cmd --list-all    # View all information
firewall-cmd --list-ports  Only look at the port information

# open portStart port command: firewall-cmd --zone=public --add-port=80/tcp --permanentRun the systemctl restart firewalld.service command to restart the firewall-zone # scope
--add-port=80/tcp  Add a port in the format of port/protocol
--permanent   If this parameter is not specified, the device will become invalid after being restarted
Copy the code