Go straight
/
Command cd
-
How to enter the parent directory
cd .. -
How to enter the current user's home directory
cd ~ -
How to enter the two directory
cd ../ .. -
Into the current directory command
cd. -
How to enter the directory / usr / isTester
cd / usr / isTester
/
Mv command
-
Moving a folder (isTester folder, move to / APP / www directory)
Music Videos ~ / isTester / / APP / www -
Moving a document (isTester.ini moved to / APP / www directory)
Music Videos isTester.ini / APP / www -
Istester.tar.gz move the current directory to / usr / ido directory and rename it to istester1228.tar.gz
mv isTester.tar.gz /usr/ido/istester1228.tar.gz -
Move the file to the parent directory
mv isTester.tar.gz ../ -
A command to move the two files isTester.tar idoxu.tar to the directory / APP / the WWW
mv isTester.tar idoxu.tar -t / APP / the WWW
/
Cp command
-
Copy the current directory to a backup directory deployment package isTester.tar.gz / APP / www / bak directory
cp isTester.tar.gz / APP / www / bak -
Copy the folder isTester to deploy directory / APP / the WWW
cp -r isTester / / APP / the WWW
/
Mkdir command
In the directory / APP / the WWW,
cd / APP / the WWW
-
Create a new folder isTester
mkdir isTester -
Create three folders isTester2 isTester3 isTester1
mkdir isTester1 isTester2 isTester3 -
Create a multi-level folder idoxu / 20.18123 million / 01
mkdir -p idoxu / 20.18123 million / 01
/
Command history
-
View command history record
history -
Mkdir command to view the execution history
history | grep mkdir -
Execution history, the number of 178 orders
! 178
/
Command tail
-
Real-time refresh log
tail -f isTester.log -
The latest real-time refresh 500 log
tail -500f isTester.log
/
Tar command
-
Compress a file isTester.ini
tar -cvf isTester.tar isTester.ini -
Readme.ini compress multiple files isTester.ini
tar -cvf all.tar isTester.ini readme.ini -
Compressed Folders isTester /
tar -cvf isTester.tar isTester / -
The package in the current directory, all jpg files into isTesterjpg.tar
tar -cvf isTesterjpg.tar * .jpg -
The package in the current directory, all jpg files into isTesterjpg.tar.gz
tar -zcvf isTesterjpg.tar.gz * .jpg -
Decompression isTesterjpg.tar
tar -xvf isTesterjpg.tar -
IsTesterjpgtargz jie_ya
tar zxvf isTesterjpgtargz
/
Ls command
-
Lists all subdirectories and files in the current directory.
ls -
All files listed in the directory (including hidden pieces **)
LS -a -
Details are listed in the file (including permissions, owner, file size, etc.)
LS the -l -
Set out in detail the contents of the current directory of all to "isTester" the beginning of the
ls -l isTester *
/
Ps command
-
View all processes
ps -A -
View java process
ps -ef | grep java -
Show all process information, along with the command line
ps -ef
/
Command top
-
Display process information
top -
Monitoring the status of each logical CPU
top, press 1 -
Highlight the current running process
top, press b -
Show full command
top, press c -
Exit top program
by q
/
Wget command
Linux system is a tool wget to download a file for Linux users is an essential tool
File address
http://51.istester.com/isTester.png
-
IsTester.jpg download file
wget http://51.istester.com/isTester.png -
IsTester.jpg download files, and store named isTester_Logo.jpg
wget -o isTester_Logo.jpg
http://51.istester.com/isTester.png -
Download isTester.jpg file download form the background
wget -b http://51.istester.com/isTester.png
/
Command find
The find command is very powerful, but also very practical, completed in two, the first time today.
Give you assignments, several scenes are more practical.
-
In / root / isTester directory and its subdirectories to find a file named isTester.ini
find / root / isTester / -name isTester.ini -
Find any file with the extension "ini" in the current directory and its subdirectories
find. -Name "* .ini" -
Looking for changes in the time / root / isTester directory file within 5 days
find / root / isTester / -mtime -5 -
Looking for changes in the time / root / isTester directory files in the previous 3 days of
find / root / isTester / -mtime +3 -
Find all directories under the / root / isTester directory
find. -Type d -
Find all files in / root / isTester directory
find / root / isTester / -type f
/
Command continues to find (Advanced)
The find command is very powerful, but also very practical, completed in two, the first time today.
Give you assignments, several scenes are more practical.
-
In the current directory, all files in the common search for the word istester
find ./ -type f | xargs grep " istester" -
In the current directory, delete everything within one day
find ./ -mtime -1 -print | xargs rm -rf -
In the current directory, delete everything in the previous 10 days (when practical operation, need to be cautious, make sure to build in their own directory, do not delete the system directory ...)
the Find ./ -mtime +10 -print | xargs RM -rf -
Delete files with zero size files
find ./ -size 0 | xargs rm -rf
/
Rm command
rm is commonly used commands, functions of the command to delete the directory / file (can be deleted at the same time, multiple files / directories)
Of course, this is a very dangerous command, it is recommended to use less misuse (such as recurrent rm * -rf command with caution)
-
Delete / root / files in isTester / directory isTester.ini (you will be asked whether to delete)
RM /root/isTester/isTester.ini -
Forcibly removed under / root / isTester / directory file isTester.ini (direct deleted, the system will not prompt)
RM -f /root/isTester/isTester.ini -
Delete all .log files in the / root / isTester / directory
rm -f /root/isTester/*.log -
Ido / delete files in the / root / isTester / folders directory
rm -r / root / isTester / ido / -
Ido / files in to forcibly remove / root / isTester / folders directory
rm -rf / root / isTester / ido / -
Delete all the contents of / root / isTester / directory
rm -rf / root / isTester / *
/
File Operations Command Series
-
Create a file, you have to know which of command? (Write at least two ways)
. 1) Touch isTester.ini
2) VI isTester.md
. 3) echo 'only Test'> isTester.com
. 4) CP isTester.ini isTester666.ini
. 5) LS> filelist.txt -
At the same time create a file idoxu.ini isTester6.ini
Touch isTester6.ini idoxu.ini -
While creating 2000 files isTester0001.ini - isTester2000.ini
Touch istester {0001..2000} .ini -
Change the file isTester.ini time to the current time
touch isTester.ini
/
View Files series of commands
/ **
command prompt
#cat by the first line displays the file content
#tac beginning to show from the last row, you can see the tac is cat written backwards!
#more page by page display file contents
#less and more similar, but better than more, he can move forward flip!
#head look at the first few lines
#tail look at the tail lines
#nl show when stopped by the output line number!
** /
-
IsTester.ini view the file contents
cat isTester.ini -
Look file isTester.ini first 20 rows of content
head -n 20 isTester.ini -
IsTester.ini see the file contents last 30 lines
tail -n 30 isTester.ini -
Content of 10 to 20 lines display the file isTester.ini the
head -n 20 isTester.ini | tail -n 10 -
IsTester.ini reverse displays the file contents of the first 10 rows of the
tac isTester.ini | head -n 10 -
IsTester.ini display file contents of the first 10 rows, and displays the line number
nl isTester.ini | head -n 10
/
Yum & scp command
Suppose the current server ip 192.168.1.23
-
192.168.1.23 192.168.1.22 copy files from a Linux server to server isTester.ini
scp [email protected]: /root/idoxu/isTester.ini / root / idoxu -
Linux servers from 192.168.1.22 copy directory isTester / server to 192.168.1.23
scp -r [email protected]: / root / idoxu / isTester / / root / idoxu -
Linux installation scp command (assuming a centos server command yum)
yum the install-OpenSSH Clients
/
command
clear
df
du
ifconfig
-
View the current server ip
ifconfig -
View the current server hard disk space
df -h -
View directory isTester / space occupied
du -sh isTester -
Clear the current terminal screen
clear
/
Vi + chmod command
/ **
vi + create a file to edit the file.
chmod command is used to change the access linux file system or directory.
** /
-
Create a file isTester.ini
vi isTester.ini -
Contents of the file to "Learn Linux Day 21, the I'm Idolaoxu, in shenzhen.
"
Input i, enter edit mode, typing, esc command mode: wq save. -
Anyone can file isTester.ini to read
chmod + r isTester.ini -
The isTester.ini set only the file owner can execute
chmod u + x isTester.ini -
Set all permissions to the file isTester.ini
chmod 777 isTester.ini (or chmod a = rwx isTester.ini)
Note: chmod command usage, there are many, as are several, to meet the daily needs.
/
End, command, these almost enough.
If you encounter some non-high-frequency command, self-Baidu / Google can get.