Common Linux operations (based on centos7)

Centos8 firewall and port####

Check whether a port of the firewall is open
firewall-cmd --query-port=3306/tcp
Open firewall port 3306
firewall-cmd --zone=public --add-port=3306/tcp --permanent
View firewall status
systemctl status firewalld
Turn off the firewall
systemctl stop firewalld
Open firewall
systemctl start firewalld
Open a port
firewall-cmd --zone=public --add-port=40000-45000/tcp --permanent
Don’t forget to execute it immediately after setting
firewall-cmd --reload
View all open ports under the firewall
firewall-cmd --zone=public --list-ports

Common commands

View the current path: pwd

Unzip: tar -xvf file name

Move: the path where the mv file name is moved

Rename: mv old file name new file name

Enter the directory: cd path

View file: ls

Create a blank file: touch file name

Create directory: mkdir directory name

Delete directory: rmdir

Delete the directory and all the following files: rm -rf directory name

Delete file rm file name

Delete the file without prompting: rm -f file name

Copy file: cp file name

View the specified port: netstat -ntlp|grep port

View the specified software: ps -ef|grep software name

Common Directory#####

/bin Run script that all users can use
/sbin Run script that can only be used by root user
/lib binary package
/lib64 64bit binary package
/dev device management file
/home Home directory of ordinary users
/mnt is used to mount external devices
/var Some directories that are often modified to increase data
/usr is generally used to install applications
/boot linux system boot related directory
/etc configuration file
/media multimedia directory
/root root super administrator's home directory

vim editor####

In centos7, the system has its own vim editor, if you cannot use it, you can use the installation command to install

yum -y install vim

Three modes of vim#####
  1. Normal mode: open the file for the first time, or press the esc key in other modes to enter the normal mode

  2. Edit mode: Press i, a, o in normal mode to enter edit mode, press esc to exit edit mode and enter normal mode

  3. Command line mode: press ":" in normal mode to enter command line mode

Normal mode is equivalent to a bridge to switch to the other two modes

Vim common operations

Copy a row of data: yy

Copy n rows of data: n yy

Paste the copied content: p

Quickly switch to the first line: gg

Quickly switch to the nth line: n gg

Quickly switch to the end of the line: G

Delete the line where the cursor is: dd

Delete n lines from the cursor: ndd

Turn on the line number display: :set nu

Leave vim temporarily::shell

Return to vim from exit mode: exit

Save::w

Exit: :q

Force exit: :q! (If you do not make changes to the file, you need to force exit)

Save and exit: :wq

Recommended Posts

Common Linux operations (based on centos7)
Install MySQL 8.0.16 on Linux Centos
Install Zabbix 3.4 based on CentOS 7
Install MySQL on Linux CentOS7 (Windows)
​Install Oracle database on CentOS Linux
Build Elasticsearch 6.2.4 (centos) based on docker
CentOS 8 is officially released based on Red Hat Enterprise Linux 8
Build Nginx environment on Linux (CentOS)
Build Discuz Forum based on CentOS
Install Jenkins on linux centos (non-docker way)
Build WeChat applet service based on CentOS
Configure Nginx reverse proxy based on CentOS 7
Configure Nginx load balancing based on CentOS 7
Configure Nginx forward proxy based on CentOS 7
Build WeChat applet service based on CentOS
Linux Mint 19 will be based on Ubuntu 18.04 LTS
Build Nginx based on Centos 7 (including virtual host)
Cloud server builds Discuz forum based on CentOS
How to install RPM packages on CentOS Linux
Configure Nginx to start automatically based on CentOS 7
Common command usage of nmcli based on RHEL8/CentOS8
Install Docker on Centos7
Linux Network Foundation (CentOS7)
install LNMP on centos7.4
Linux (centos7) build gitlab
Build k8s1.9.9 on centos7
Install Java on Centos 7
Xfs configuration on centos7
Configure Ocserv on CentOS 6
Nodejs install on centos7
Install FFmpeg on CentOS 8
Install RabbitMQ on CentOS 7
Install Node.js on Centos
Linux Centos7 install jdk1.8
CentOS (linux) install PostgreSQL
Maven install on centos7
Install MongoDB on CentOS 7
Jenkins build on centos
Install Surelog on CentOS8
Linux notes (1): CentOS-7 installation
Deploy vuepress on centos7
How to quickly install docker on Linux (Centos version)
Openjdk install on centos7
Install Jenkins on centos7
Use RapidSVN on CentOS7
install RabbitMQ on centos
Install RabbitMQ on CentOS 7
install Docker on centos6.5
Linux firewall related configuration commands and operations (centos and ubuntu)
install oracle on centos
Install Elasticsearch 6 on centos7
Detailed tutorial on installing JDK8 on Linux system (CentOS7 installation)
Install RabbitMQ on CentOS7
Deploy Jenkin on centos7
Linux CentOS 7 installation tutorial
Centos 7 install JDK (Linux install jdk)
A preliminary study on centos mysql-configuration, basic operations and problems
Install mysql online on centos
Know Linux and install CentOS
Install ElasticSearch 7.x on CentOS 7
Glusterfs cluster installation on Centos7