centos6.x

-a INPUT -p TCP -m state --state NEW -m TCP --dport XXXX -j ACCEPT # Yy (copy) p(paste) dd(delete) yy p # start edit mode, change XXXX to the port we want to openCopy the code

centos7.x

Install the firewall plugin: Yum install firewalld firewalld-config # check whether the firewall port is open firewall-cmd --query-port=3306/ TCP # Check whether the firewall port is open Firewall-cmd --add-port=80/ TCP --permanent firewall-cmd --state # Check firewall status systemctl start firewalld Sytemctl disable firewalld # Stop and disable firewalld startup firewall-cmd --reload Firewall -cmd --zone=public --list-portsCopy the code

Linux directory Structure

  • Bin (binaries) Stores binary executable files
  • Super user binaries (sbin) stores binary executable files, which can be accessed only by root
  • Etc (etcetera) stores system configuration files
  • Usr (Unix shared Resources) is used to store shared system resources
  • Home The root directory for storing user files
  • Root Superuser directory
  • Dev (Devices) Stores device files
  • Lib (library) contains shared libraries and kernel modules needed to run programs in the file system
  • MNT (mount) Installation point for the system administrator to install temporary file systems
  • Boot stores various files used for system boot
  • TMP (tmtempo rary) is used to store temporary files
  • Var (variable) is used to store files whose data needs to be changed during running

Getting started Common commands

1. Switch directory CD Directory name CD.. Switch to the upper directory CD ~ Switch to the root directory CD/Switch to the root directory "/" CD - Switch to the directory where the last operation was performed PWD Display the absolute path 2. Display file list command ls display visible files -l display file details -a display all files (including hidden files) -h display file size in friendly units (K) 4. Rmdir Directory name (Only empty directories can be removed) 5. Command for browsing files cat file name more file name less file name tail -fn 200 file name (dynamically update the first 200 lines of the file) 6. Command for creating a file touch file name Command for creating a directory mkdir directory name mkdir -p directory name/directory name (multiple directory creation) 7. Mv file name directory/mv file name directory/new file name (move the file and rename it) MV file name New file name (rename) Example: [root@loclahost ~]# mv test2/ a.testt test1/ b.test1 Cp file name cp file name directory/new file name cp -r directory Directory To copy a directory and its contents to a folder, that is, recursive replication./ To the current directory 9. Delete a file rm file name rm -r non-empty directory name (delete a non-empty directory recursively) -f: delete a file directly without asking Vim File name Enter the common mode (browse but not edit) I (Enter the editing mode) ESC (return to the common mode) : (Switch to the bottom line mode)(switch to the common mode first) :wq Save and exit :q Exit not save :q! Forced exit 11. Package the command for decompressing the decompression package (seldom used in package: Tar -c Mandatory for packing and compression -x Mandatory for unpacking and decompressing -v Lists the files. (Optional) -f Package Decompression and undecompression are mandatory. -z Automatically identifies the decompression and compression (optional). If the decompression is not performed, add z to the package :tar -cvf [generated file name] [Generated file name].tar.gz [file name to be compressed] Package a tar. Gz package :tar -xvf xxx.tar -c [directory to be unpacked] (used to decompress.tar suffix) Decompress :tar -zxvf XXX.tar.gz. C [Directory to decompress] (ending with.tar.gz) Decompress and rename: Tar -xzf xxx.tar.gz -o > a.txt (unzip xxxx.zip) Direct RPM - the ivh JDK - XXX. RPM 12 system command ifconfig IP address information such as ping check the network the halt (shutdown, general hung can) reboot (restart, general hung can) ps - ps - ef ef view all process | Grep filters (| pipe can screening all files) example: ps - ef | grep wook screening processes associated with wook kill 9 process id (kill process)Copy the code

Commands commonly used online

Useradd -g apps -d /home/wookhome -m wook # Create a new group name apps groupAdd apps # create a new account wook,-g specify the user group -d specify the user login directory useradd -g apps -d /home/wookhome -m wook # change the password File nohup java-jar. Jar & # switch to XXXX account su XXXX # check environment variable echo Chmod a+x directory or file # set up a soft connection. Create a directory or file with the same structure as the source file.) ln -s Source file destination file The pid line process) netstat NLP | grep: 3306 # # for process (19264) to monitor the port netstat anp | grep # 19264 will mysqldata.. SCP mysqldata.tar.gz username @ip:/data/ # grep SCP mysqldata.tar.gz SCP mysqldata.tar.gz username @ip:/data/ # grep SCP mysqldata.tar.gz SCP mysqldata.tar.gz username @ip:/data/ # grep sed -i "s/ g" 'grep Find field - rl path ` # replace special characters sed -i 's #' ' '\ "special characters \' '#' ' '\" to replace with 1 \ ", \ "to replace with 2 \", \ "to replace with 3 \'" '# g *. The conf # nohup will generate nohup. TXT log, To cancel the nohup/path >/dev/null 2>&1 & # Linux timer command, run the following command: 0 5 * * * / usr/bin/curl http://192.168.1.1:5555/url/api crontab -e # # the Java view the current server process the JPS springboot jars start to revise the port 9999 Active = dev-dserver. port=9999 -jar test.jar # Check CPU usage top # Check server memory usage du -lh / path/pathCopy the code

eggs

After editing the file, type /XX, where XX is what you want to search for, # sudo dhclient can solve the problem that ifconfig does not display IP address # why nohua XXXX & is used as background command? &(CTRL + C cannot break the program) nohup(close shell cannot break the program), in order to make the process really not affected by CTRL + C and shell closing in the shell, # chomd [ugoa] [+-=] [RWX] File or directory U, g, O, a owner owner owner group other users all users +, -, = Add and remove Settings r, w, X indicates read/write execution permission. [wook@localhost local]$ll /etc/sysconfig/iptables -rwxr-x-w-. 1 root root 541 Apr 18 15:12 /etc/sysconfig/iptables RWX r-x -w-, the first user is the owner, the second user is the owner group, and the third user is the other user. Other users only have 'execute' permission to consider writing JVM command operations...... To be continuedCopy the code