(1) Order
ls--Listing files
LS Displays the current directory file
Ls-la gives a long list of all the files in the current directory, including hidden "files that start with a period"
LS A * lists all files in the current directory that begin with the letter A
Ls-l *.doc gives all files that end with. doc in the current directory
(2) command cp--copy files
CP afile Afile.bak Copy the file as a new file Afile.bak
CP afile/home/bible/Copy the file Afile from the current directory to the/home/bible/directory
CP */tmp copies all hidden files in the current directory to the/tmp/directory
CP-A Docs Docs.bak recursively copies the docs directory under the current directory to the new directory Docs.bak, preserves the file attributes, and copies all the files, including hidden files that begin with a period. For the sake of convenience,
-A option contains the-r option
Cp-i ask the user before overwriting
Cp-v tell users what they are doing
Cp-r
(3) Order
mv--Moving and renaming files
MV Aflie bfile Renaming afile to bfile
MV Afile/tmp Move the afile under the current directory to the/tmp/directory
(4) Order
rm--Deleting files and directories
RM afile Deleting files Afile
RM * Delete all files in the current directory (files not hidden)
The RM command does not delete the directory unless the-R (recursive) parameter is also specified.
RM-RF domed Delete the domed directory and all the content it contains
Rm-i * Deletes all files starting with the letter A in the current directory, and prompts the user to confirm each deletion
(5) Order
cd--Changing the Directory
CD Switch to home directory
CD ~ Switch to home directory
CD/TMP switch to Directory/tmp
cd dir switch to dir directory in current directory
CD/Switch to root directory
Cd.. Switch to the top level directory
Cd.. /.. Switch to the top level two directory
CD ~ Switch to the user directory, such as the root user, then switch to/root
(6) Order
mkdir-Building a Directory
mkdir phots to create a directory named photos in the current directory
Mkdir-p This/that/theother Creating a specified nested subdirectory under the current directory
(7) Order
mkdir--Deleting a directory
mkdir will delete empty directory
(8) Order
More, less--view file contents
MORE/ETC/PASSWD viewing the contents of/etc/passwd
Function: Pagination display command more The file More command can also be passed through the pipe character (|) Used with other commands, such as:
PS Ux|more Ls|more
LESS/ETC/PASSWD
View/ETC/PASSWD's content
(9) Order
grep--Search for file contents
grep Bible/etc/exports finds all rows that contain Bible in file exports
Tail-100/var/log/apache/access.log|grep 404 finds rows that contain "404" in the 100 rows of the Web server log file Access.log
Tail-100/var/log/apache/access.log|grep-v Googlebot in the 100 rows of the Web server log file Access.log to find rows that are not accessed by Google
Grep-v ^#/etc/apache2/httpd.conf Find all non-commented lines in the main Apache configuration file
(10) Order
find--Finding files
Find-name *.rpm Locate the RPM package in the current directory
Find. | grep page finds the file name in the current directory and its subdirectories that contains the page,
Locate traceroute find the file name that contains traceroute anywhere on the system
(11) Command vi-Edit file
Gvim opener
Vi/etc/bubby.txt Edit file with vi/etc/bubby.txt 
Vim/etc/bubby.txt Edit file with vi/etc/bubby.txt Quick action: Switch window: alt+1,alt+2 fullscreen: ALT + Enter Vim hang (pause): Ctrl + Z, after pausing for other shell operations, after the end can be switched back to the Vim interface via FG command to continue editing
: Mr: View History file Record (note: Mr Uppercase): SP Landscape Switch Interface window
: VSP Vertical Switch Interface window facilitates multiple file-control encodings (e.g.) emacs/etc/bubby.txt edit files with Emacs/etc/bubby.txt< Span class= "Apple-converted-space" >&NBSP;
(12) command RZ, sz--file upload download
Run command sudo rz, that is, receive files,
Xshell will pop up the file selection dialog box, After selecting the file, close the dialog box and the file will be uploaded to the current directory in
Linux. The
Run command sudo sz file is to send files to Windows (the saved directory can be configured) more convenient than the FTP command, and the server does not have to open the FTP service.
(13) command cat--display file contents
Cat File&NBSP;
(14) Command ps--view process
PS [options] DESCRIPTION (description): PS command displays some information about the run program options. If you want to display some duplicate information for an option, use the top command instead. The
uses standard syntax to view each process on the system.
Ps-e
Ps-ef
Ps-ef
ps-ely
(15) Order kill--Kill the process
[Email protected] ~]# kill-signal%jobnumber
[Email protected] ~]# kill-l parameter:-l This is the lowercase of L, which lists the current signals (signal) that kill can use? A total of 62 signals.
Signal: What kind of instructions do you give to the job at the back? With the man 7 signal know:-1: Re-read the parameters of the configuration file (similar to reload);-2 represents the same action as input by the keyboard [Ctrl]-c;-9: Forcibly delete a job immediately;-15: Terminates a job in a normal program manner. And
-9 is not the same.
Example one: Find out the background work in the current bash environment and delete the work.
[email protected] ~]# jobs [1]+ Stopped
Vim BASHRC [[email protected] ~]# kill-9%1 [1]+ has cut vim BASHRC
(16) command stop, start--reboot Tomcat
./catalina.sh Stop
./catalina.sh Start
(17) Command top-view CPU, memory
(18) Command pwd--view current path
(19) Order tar--package, unpack rar
TAR-CVF **.tar a.jsp B.java A and B into **.rar&NBSP;
tar-xvf **.tar a.jsp B.java will **.tar unpack
(20) command tail--view file details
Tail-f aaa.txt See aaa.txt file details
tail-n x aaa.log x: Last few lines
(21) Command head--view file name and suffix
head-n x aaa.log& nbsp; x: Start a few lines Aaa.log: the name and suffix of the file to view
(22) command diff--Compare file contents
diff dir1 Dir2 Compare directory 1 with directory 2 file list is the same, but do not compare the actual contents of the file, The difference is that
diff file1 File2 compares the contents of file 1 with file 2, and if it is a text-formatted file, the content is not the same, and if the binary code only means that two files are different
Comm file1 file2 Compare files, Displaying two files with different contents
(23) command ln--Establish connection
Ln source_path target_path Hard Connection
Ln-s source_path target_path Soft Connect
(24) command touch- -Create an empty file
Touch aaa.txt Create an empty file with the file name Aaa.txt&NBSP;
(25) command man-- View Help for a command
Man LS displays help for the LS command
(26) command w--displays details of the logged-on user sarge:~# W&NBSP;
( 27) Command who--displays the logged in user
sarge:~# who&NBSP;
(28) command last--View recent users logging into the system
sarge:~# Last
(29) Command date--system date setting date-s "060520 06:00:00″ Set the system period is May 20, 2006 6 o'clock full.
(30) Command clock--clock setting
Clock–r read time parameters in the system BIOS
Clock–w writes the system time (such as the time set by date) to the BIOS
(31) Command uname--View system version
Uname-r shows the version of the operating system kernel
(32) command reboot, shutdown--shut down and restart the computer
Reboot restart your computer
Shutdown-r Now restarts the computer, stops the service, and then restarts the computer
Shutdown-h now shut down the computer, stop the service, and then shut down the system
Halt shut down the computer generally with shutdown-r now, in rebooting the system is, shutting down the related services,
So is shutdown-h now.
(33) Command su--Switch User Su-switch to root user
SU–ZHOULJ switch to ZHOULJ user,
Note:--he is critical, using--that will use the user's environment variable
(34) Command free--view memory and swap partition usage
sarge:~# Free-tm
(35) Command uptime--the current time, the system is running to the current elapsed time, the number of users connected, the last minute, five minutes and 15 minutes of system load
sarge:~# Uptime
(36) Command vmstat--monitor virtual memory usage
# Vmstat
(37) Command iostat--disk throughput
-C Displays only CPU rows
-D Display Disk rows
-k displays disk output in kilobytes
-T includes timestamps in the output
-X includes extended disk metrics in the output
(38) Command clear--Clear Screen
(39) Restart Tomcat
(40) Change user chown the owner or group of the change file or directory
Xshell Common Commands