Some friends left a message before saying that they want some common commands of the operation terminal. Today, they sorted out a very complete command guide for everyone
1. Linux version
A. Kernel version format
- Xx.yy. Zz: indicates the xx major version, YY minor version, and last ZZ version
- If the version is smaller than 2.6, the odd-numbered version is the development version, and the even-numbered version is the stable version
- Later than 2.6: Longterm long-term support, stable, mainline development version
B. Common distributions
- Red Hat
- Ubuntu
- CentOS
- Debian
- Fedora
2. Important concepts
- Root account: Windows administrator account
- “/” Root directory: my Computer on Windows
System Management
System management is for beginners is the most brain of some knowledge points, but it doesn’t matter that we roll up our sleeves and fight against it
1. Logical volumes and LVM
A. Volumes are used to manage disks at different levels
B. VM is divided into three layers
- PV physical volume
- VG volume group
- LV LV
C. Common commands
- Pvcreate to build PV
- Vgcreate establish VG
- Lvcreate establish LV
- Lvextend expand LV
- PVS view PV
- VGS see VG
- The LVS check LV
2. Text and file search
a.grep
- -i ignores case
- – v reverse
- -a Processes binary files
- -r recursively
b.find
- -name Searches by file name
- -perm Searches by permission
- -user Searches by owner
- -type Searches by file type
3. Configure the network
A. Network configuration commands
- Ifconfig View and configure network interfaces
- IP View and configure network interfaces and routes
- Nestat Displays the status of the process listening port
- Network and NetworkManager Network management scripts
B. Configuration file
- Ifcfg-eth0 Indicates the eth0 nic configuration file
- Networking Host name configuration file
- Resolv. conf Domain name configuration file
4. Software installation and update
A.r PM installation
- -i installation
- – q query
- – U upgrade
- – e uninstall
B. Source code compilation and installation
- ./configure
- make
- make install
C. Move and rename the MV
- Install yum install XXX
- Uninstall yum remove XXX
- Yum update XXX
5. File system
A. Common commands
-
Fdisk Partition tool
- -l (lowercase L) Displays partition information
- Fdisk /dev/sdx indicates a storage partition
-
Df Displays the space used by a partition
-
Du Displays the space used by the folder
-
MKFS format command
- Mkfs. ext4 Formats an ext4 file system
- Mkfs. XFS formats the XFS file system
b.ex4
6. Services and logs
A. Command for viewing service status
- The service usage: service service name start | stop | restart | status
- Systemctl usage: systemctl start | stop | restart | status service name. The service
B. Preparation of service configuration files
C. Common system logs
- /var/log Default directory for storing system logs
- Message System log
- Dmesg kernel startup logs
- Secure Security Logs
D. Application logs
7. Disk partitions
A. Link files
- A symbolic link
- Hard links
B. Mount command
-
-t Indicates the type of the file system
-
-o Mount options
- Ro Read-only mount
- Rw read-write mount
- Remount mount
C. Configure the /etc/fstab file
8. System startup process and troubleshooting
A. Describes the system startup process
- BIOS selects the boot device
- MBR Hard disk bootable sector
- GRUB Linux system bootable tools
- The kernel
- Init or systemd (previously init on CentOS 7)
- Service service or Systemd service (CentOS 7 previously only service service)
- Start the TTY and wait for the user to log in
B. Update the kernel version
-
Update using RPM
- Fast installation speed
- The latest version is not available
-
Source code compilation method updated
- You can use the latest version
- The compilation time is long