Next paragraph (i) Linux real operation--permissions, task scheduling, disk partitioning
4. Network Configuration 4.1 Nat mode
The network configuration we are currently using is NAT mode.
Under Windows CMD, the network configuration of this machine can be obtained through the ipconfig command.
The network configuration of virtual machines can be obtained by Ifconfig under Linux
How do the two systems communicate when running a Linux system in a virtual machine in a Windows system?
In fact, the Windows system and the native Linux communication is through the VMNET8 virtual network card, the two formed a network, 192.168.177.128 and 192.168.177.1 is the network under the two IP address.
So how does this machine communicate with other machines? The above figure can be seen, the real network card configuration of the native real IP address, that is, the local LAN display of the IP, This machine (ip:192.168.1.100) and other machines within the same intranet (ip:192.168.7.101) can ping each other, together constitute a local area network.
Then this machine is how to access Baidu to inquire information? Access to the outside network around the gateway, the same LAN is through the network interfacing access to the Internet. The Linux access extranet is accessed through the VMNET8 Virtual network card (ip:192.168.177.1) through the Linux IP (ip:192.168.177.128) to borrow the real network card's IP (ip:192.168.1.100).
4.2 Linux Network Environment configuration method 4.2.1 Automatic acquisition
This will automatically obtain the IP after each Linux boot, this method is not applicable as a server, because each time the IP address automatically obtained may be different, and our server IP needs to be fixed.
4.2.2 Setting the specified IP
This approach is not difficult to understand, we also have to set up in the company and the company intranet consistent fixed IP. Here we directly modify the configuration file.
Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Increase IP configuration
You must restart the service to take effect after modification
Service Network Restart # Restart Network Service reboot # reboot system
5. Process Management 5.1 Linux Process Introduction
- In LINUX, each executed program (code) is called a process. Each process is assigned an ID number.
- Each process corresponds to a parent process, and the parent process can replicate multiple child processes. For example WWW server.
- Each process can exist in two ways. Front and back office, the so-called foreground process is the user's current screen can be entered into line operation. The background process is actually in action, but because of the process that is not visible on the screen, it is usually performed in the background.
- The services of the general system are in the way of the background process, and will reside in the system. It was not until the shutdown was over.
5.2 Viewing the process performed by the system--ps
Grammar:
PS (option)
Because the PS command can support a considerable number of system types, so the options are much more outrageous, here are several commonly used, more to the PS command to view, in addition, the PS command has two different syntax styles--bsd and UNIX two styles, the difference is that the BSD format parameters are not added-,unix/ LINUX format--The parameters are usually added before--the two styles may display different effects, such as PS aux and ps-aux are different, such as the-u parameter represents the UID of the printing process, and the parameter U represents the details of the display process. Be careful when you use it.
- Ps-a: Displays all process information for the current terminal
- Ps-u: Displaying process information in a user's format
- Ps-x: Shows the parameters that the background process is running
Result parameters:
- User: Name
- PID: Process Number
- %CPU: percentage of CPU consumed by process
- %MEM: Percentage of the process consuming physical memory
- VSZ: The amount of virtual memory that the process occupies (in KB)
- RSS: The amount of physical memory that the process occupies (in KB)
- TT: terminal name, abbreviation.
- STAT: Process state, where S-sleep, s-means that the process is the pilot process of the session, N-Indicates that the process has a lower priority than the normal priority, R is running, D-short wait, Z-zombie process, T is tracked or stopped, etc.
- STARTED: Start time of the process
- Time:cpu time, which is the total time that the process uses the CPU
- Command: The commands and parameters used to start the process, if too long, are truncated to show
5.3 PS Command Use example
(1) Displays all current processes in full format, viewing the parent process of the process.
Command explanation: Ps-ef is displaying all current processes in full format
Command parameters:-e: Show all Processes;-f: Full format.
Result parameters:
- UID: User ID
- PID: Process ID
- PPID: Parent Process ID
- C:cpu the factor used to calculate the execution priority. A higher value indicates that the process is CPU intensive, the execution priority decreases, and the smaller the value, indicating that the process is an I/O intensive operation and the execution priority increases
- Stime: The time the process started
- TTY: Full terminal name
- TIME:CPU time
- CMD: The commands and parameters used to start the process
(2) View the parent process number of the sshd process
5.4 Terminating process--kill & killall5.4.1 Command Introduction
Consider stopping a process if it is half the time it needs to be stopped, or if a large system resource has been eliminated. Use the KILL command to complete this task.
Command syntax:
Kill [option] process number # kill process with process number Killall process name # kills a process with a process name, also supports wildcards, This is useful when the system becomes slow due to heavy load
Options:
- -A: The corresponding relationship between the command name and the process number is not restricted when the current process is processed;
- -L < information number;: If the < information number > option is not added, the-l parameter lists all information names;
- -P: Specifies that the KILL command prints only the process number of the related process without sending any signals;
- -S < information name or number;: Specify the information to be sent;
- -U: Specify the user;
- -9: Indicates that the forced process stops immediately.
The 5.4.2 Kill command uses the
(1) Kick off an illegal login user
(2) Terminate the remote login service sshd and restart the sshd service again at the appropriate time
(3) terminating multiple gedit editors (killall, terminating processes by process name)
(4) Forced killing of a terminal (-9: Forced termination)
5.5 Viewing the process tree
Grammar:
Pstree [Options]
Options:
- -P: Show PID of the process
- -U: Shows the user who owns the process
6. Service Management 6.1 Introduction to service Management
Service is the essence of the process, but is running in the background, usually listen to a port, waiting for other programs, such as (mysql,sshd, firewalls, etc.), so we are called daemons, is a very important knowledge point in Linux.
Grammar:
Service name start|stop|restart|reload|status
It is important to note that the service is not used after Centos7.0, but Systemctl.
View the current firewall status, turn off the firewall, and restart the firewall.
Note: This is only temporary, and when the system is restarted, the previous settings for the service are returned. Use the CHKCONFIG directive if you want to set a service to take effect from startup or off permanently.
6.2 View Service Name
There are two ways to view services, as follows:
One way: You can see it by using setup and then selecting System Services.
Mode two:/etc/init.d/service name
6.3 Operating level of the service
If you accidentally set the default RunLevel to 0 or 7, you can recover by entering single-user mode and modifying to normal.
6.4 chkconfig directive
The Chkconfig command allows you to set the individual runlevel for each service to start and close.
Grammar:
Chkconfig--list # View all services chkconfig--list | grep service name # View a service condition chkconfig Service name--list # View a service condition chkconfig--level 5 Service name on/off # Set a service to turn on or off at run Level 5
7. Introduction to group Management 7.1 groups
Each user in Linux must belong to a group and cannot be independent of the group. In Linux, each file has the concept of owner, group, and other groups.
- Owner
- Your group
- Other groups
- Change the group where the user resides
7.2 File/directory owner 7.2.1 created
In the initial case, the file/directory is created as the owner of the file/directory.
Create group bosses, add user Feng, create files through Feng, view user and group information for files.
7.2.2 Changing the user/group to which the file belongs
Grammar:
Chown username file # change files belong to user chgrp groupname file # change files belong to group
This has been introduced before, do not repeat.
7.3 Other Groups
In addition to the owner of the file and the user in the group, other users of the system are other groups of files.
7.4 Changing the group to which the user belongs
You can change the group in which a user resides by using root administrative privileges.
Grammar:
Usermod-g NewGroup Usernmae
8. YUM8.1 Yum Introduction
Yum is a shell front-end package manager. Based on RPM package management, the ability to automatically download RPM packages from specified servers and install them automatically handles dependency relationships and installs all dependent packages at once. The prerequisite for using Yum is to be networked.
Grammar:
Yum List | grep softwarename # Query Yum Server if there is a need to install the software yum install softwarename # Install the specified yum package
8.2 Yum Use
After uninstalling the Firefox software in the system, install it via yum.
(1) Check if the Yum server has firefox rpm
(2) If yes, remove Firefox from the system first
(3) Reinstall with Yum
(ii) Linux implementation-network configuration, process management, service management, group management