Linux basic commands
1.1 VMware Network Mode
PC PC (personal computer) Emperor
Virtual Machine Poor
Nat Mode
PC PC (personal computer) Emperor
NAT Prime Minister
Virtual Machine Poor
Benefits:
1. Each of us can have our own country (local area network) 10.0.0.200
2. Everyone's IP address can be the same
Disadvantages:
1. Complex configuration
Bridging mode
PC PC (personal computer) Emperor
Virtual Machine Poor
Benefits:
1. Simple Configuration
Disadvantages:
1. Home 10.0.0.200 at the school 192.168.21.xxx at the company 172.16.1.xxx
2. Everyone will occupy the IP address in the current environment
192.168.21.xxx
Host-only only Host Mode
PC PC (personal computer) Emperor
Host-only
Virtual Machine Poor
1.2 Linux command line features
1. command-line structure
[Root @oldboyedu50 ~]#
[Root @oldboyedu50 ~]#
[Root @oldboyedu50 ~]#
Current user's username host name Current location
Who are you, what machine are you in?
Structure of the 2.Linux command
command word [options] [parameters]
Command word
Is the most critical part of the entire command.
The only way to determine a command
Options
Adjusts the specific function of the command and determines how the command executes
Different command words will use different options.
Use space-delimited between multiple options
If you do not use the option, the default function of the command word
Parameters
is the processing object of the command word
Typically, it can be a file name, directory (path) name, or user name, and so on
The number can be 0 to more
1.3 mkdir Command
Make Directory
Mk Dir
Mkdir
Create a directory/data
[Email protected] ~]# Mkdir/data
#显示目录内容
[Email protected] ~]# ls/data/
[Email protected] ~]# ls-l/data/
Total 0
1.4 Cd Command
Go to Catalog
[Root[email protected] ~]# cd/data/
#现在当前所在位置
1.5 pwd command
Now the current location
[Email protected] data]# pwd
/data
1.6 Relative and absolute paths
Absolute path: The path starting from the root/oldboy/data
Galaxy Earth Asia China Beijing Changping District Shahe Town Shun Sha Road 8th, 4 floor, 402 classroom 7
Relative path: No path starting from root data Oldboy Lidao
The Old king next door
1.7 Touch Command
Create a file below/data Oldboy.txt
[Email protected] data]# Touch/data/oldboy.txt
[Email protected] data]# ls-l/data/
Total 0
-rw-r--r--. 1 root root 0 Jul 23:53 oldboy.txt
1.8 Vim Command
Added content for Oldboy.txt "I am studying Linux."
1) vim/data/oldboy.txt
2) Enter edit mode I ()
3) Make edits
4) Edit complete exit edit mode ESC
5) Save and exit Wq
6) Display the contents of the file
[Email protected] ~]# Cat/data/oldboy.txt
I am studying Linux.
: Wq Write quit
: Q Exit does not save
: q! Force quit does not save
1.9 echo Command
[Email protected] ~]# echo "www.lidao.com"
Www.lidao.com
[Email protected] ~]# echo "www.lidao.com" >>/data/oldboy.txt
[Email protected] ~]# Cat/data/oldboy.txt
I am studying Linux.
Www.lidao.com
Funnel >> Append information to the end of the file
[Email protected] ~]# echo "www.lidaoav.com" >/data/oldboy.txt
[Email protected] ~]# Cat/data/oldboy.txt
Www.lidaoav.com
Redirect symbol empties the contents of the file and then writes the new content
1.10 The cat command to add multiple lines
Add multiple lines
Cat >>/data/oldboy.txt<<eof
I
Am
Studying
Linux
Eof
Empty and append multiple lines first
Cat >/data/oldboy.txt<<eof
I
Am
Studying
Linux
Eof
Cat >>/data/oldboy.txt<< End Tag
I
Am
Studying
Linux
End tag
Whatever marks you can use, as long as your tail ends.
EOF End of File
1.11 Redirect Symbol
> or 1>> to add information to the end of a file
or 1> redirect symbol to first empty the contents of the file to append new content
2>> Error Append redirect error message appended to file contents
2> error redirect Clears the contents of the file before the error message is appended to the file contents
< or 0< input redirect reads data from a file
<< or 0<< Append input redirection
2>&1 the correct information and error messages are recorded in the file or used together with the >> 2>>
1.12 CP Command
Copy the Oldboy.txt (copy) to/tmp
Copy the/data directory to/TMP Cp–r/cp–a
Cp-a
#-a = = =-pdr
-p replication keeps properties intact
-D Soft Connection related
-R recursion
Linux basic commands