(This article is only normal learning record, if any error please chiefs pointed out that if this article can help you that I am also very happy friends)
First, the knowledge of Linux system
1.Linux the meaning and purpose of all the root folder (in parentheses are for example stored in a file)
/ Root directory
cd / change to the root directory
/ Bin to store executable file
/ Dev file storage device (NIC CPU)
/ Media files storage removable devices (U disk CD / DVD VMTools)
/ Opt to store the default position of third-party software
/ Tmp temporary files (log files)
/ Root root user's home directory, home folder
/ Home general user's home directory, naming the folder is named after the user
/ Etc store configuration files
/ Usr storage operating system software resources
/ Var storing files normality changes (create a website source site)
/ Proc virtual file system storage
2. [root @ localhost ~] # meaning:
root of the current logged-on user
computer name localhost
~ Current work location, home directory
- before a working directory, such as: the current working directory / etc cd / var cd - entered the / etc
# If the current user is root for the current user is an ordinary user $
Second, the commonly used Linux commands
List or folder list file ls view the current folder or any other folder, such as: ls / view file or folder at the root directory
ls -l to view the details of the list
ls -al or ls -a view details a list of all the files, you can view hidden files, hidden files before adding.
cd Change directory cd ./ current directory cd ../ parent directory cd / home enter the general user's home directory
cd ~ = cd = cd / root into the root home directory (the user is currently logged in as root) cd / home / test tast into the home directory (the user currently logged on to test)
clear clear screen ctrl + L may also be implemented
See communication network ping
the ping www.baidu.com -c 4 4 times the ping Baidu
View cat index.html file
touch index.html file is created
echo 'hello word!'> index.html write data
Note: tab completion feature can also check spelling
View more index.html or less index.html file, part of the display when reading files
more filename (displays the percentage, press the Q key to exit, enter a line out line)
less filename (not displayed percentage)
tac index.html file read
head filename defaults to 10 lines before the show
head -n 7 file name is displayed in the first seven rows
10 lines tail file name after the default display
After tail 10 line read -n 7
mkdir test Create a folder
rmdir test delete a folder
rm index.html delete files
rm -r test delete folders
rm -rf test force delete files, do not ask
cp source file copy the file object file copy cp /var/test.txt ./ var test file into the current directory
mv source file object file is moved to move the file mv /var/test.txt ./ var test file into the current directory
mv original file name to change the name of the file to modify the file name
su switch user username NOTE: switched from normal to the root account password is not required to enter su su root = root password
whoami view the current user who is
id view the current user's UID Note: UID = 1000 indicate the average user UID = 0 is a root
Check the computer name hostname
NOTE: Linux is case sensitive
service firewalld status View firewall running state
service firewalld stop turn off the firewall
Third, find files commonly used commands
1.find / etc -name '/ * network * /' such as: ifconfig -> ens33 -> find / etc -name '/ * ens33 * /' Find NIC configuration file
Note: Linux all devices are in the form of documents exist, such as network cards there is a file in Linux to represent the network card (NIC configuration file)
find 路径 [-name|-type|-time|-size]
-name find the specified file names
-type find the specified file type
-time (hours, minutes, seconds) within the specified time or the outer find modified file.
Find a modified file within the specified time
find -atime -2 final document of 2 * 24 hour access
find -ctime -2 2 * 24 last file status is changed files
Finally find -mtime -2 2 * 24 is changed document data file
-size find the file specified size, such as:. find -size + 1000c -print Find files larger than 1k current directory and print out
2.locate sshd_confg
updatedb need to update the database file location, then look
whereis sshd_confg system commands to identify the specific location of system commands, find the file may not be able to find! ! !
whereis cat find the cat command manual
3.grep find the specified keyword content files, folder names, contents of the file name you want to find grep
grep ‘ens33’ /etc/sysconfig
cat /etc/sysconfig |ens33
Fourth, the operating mode switch and
Shutdown: Before shutdown shutdown -h shutdown -c cancel a command to halt power off organ
Reboot: reboot init 6 shutdown -r
Login login user name
Exit exit loginout
Five, Linux system mode
init process
0: shutdown, shutdown mode
1: single-user mode
2: multi-user mode
3: Full multi-user text mode
4: The system is not used, reserved generally do not
5: Graphical Mode
6: Restart mode
Six, centos 7 NIC configuration (VM card type selection is NAT, way is to assign IP DHCP):
1.IP automatic acquisition, first find the configuration file, / etc / sysconfig / network-scripts / ifcfg-ens33
vim / etc / sysconfig / network- scripts / ifcfg-ens33 absolute position (Note: at the beginning of the absolute path to Linux /, or root directory)
TYPE = "Ethernet" card type
BOOTPROTO = "dhcp" NIC IP acquired form, ip configuration (NONE / DHCP / STATIC)
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
NAME = "ens33" name card
UUID = "ae04ed91-a630-435e-b327-583632895fa0" universal unique identifier
DEVICE = "ens33" name card
ONBOOT = "yes" boot loader NIC configuration file
Restart card
/etc/init.d/network restart
service network restart
systemctl restart network
View card information, and configuration
View all ifconfig card information
ifconfig ens33 View ens33 card information
ifdown ens33 Close card
ifup ens33 open card
View all ip add IP card
ifconfig ens33 192.168.1.160 255.255.255.0 manually configure IP, temporary restart gone
2. Configure a static IP
Automatically obtain IP, first find the configuration file, / etc / sysconfig / network-scripts / ifcfg-ens33
Modify the network card to obtain an IP in the form of BOOTPROTO = static
Add IPADDRESS = 192.168.1.160
NETMASK = 255.255.255.0
GATEWAY = 192.168.1.2 (NAT settings in the virtual network editor view)
DNS1 = 114114114114
Modification shown in FIG.
ifdown ens33 closed card ifup ens33 open the card or card reboot
ifconfig to see if the amendment is successful IP