pwd: Display the current path
cd: Change directory
Usage: CD
CD ../ switch to the parent directory
cd / switch to the root directory
cd ~ (or only cd) switch to the current home directory (Home under the user name folder named) / root directory
Create a directory mkdir
mkdir -p directory name to create a recursive directory
rmdir to delete empty directories
Usage: rmdir directory name
can also be used: rm -rf directory name
ls view files or directories
main options:
the -l list the details of a directory or file. For example, permission, modification time and so on
-a list all files in the current directory, including hidden files (dot at the beginning are already hidden files)
vi text editor
type i to enter edit mode
exit edit press the ESC key to
exit without saving::! q
save and exit:: wq
input / enter search
input: set nu, the number of lines of each line
keypad G, may be positioned directly most end
cp Copy
Usage: cp [Option] filename or directory the destination address
of all directories and files in the directory and copy directory -R
cp a.txt b.txt copy a file, named b and the other file (directory name)
mv Mobile
Usage: mv file or directory target directory
mv a.txt ../ to move a file to the parent directory (one file to another directory without renaming)
mv will be a a.txt ../b.txt and a file is moved to the renamed file b (to move a file to another directory and rename)
To delete a file or directory rm
-f Forces deletion
-r delete a directory
used: rm -rf file or directory
find Find files
Usage: find [path] [options]
Common options are:
. find -name * .log files in the current directory to find the ending in .log
find / -name log to find log directory in the root directory named
grep filter
to locate the character (string) in the specified file and prints the line
Usage: grep string filename
grep string band band file to find the file in the file
cat to display the contents of a text file
usage: cat cat file name of the file name
View a few lines before the head
Usage: head -n 5 filename
tail from a specified point to the beginning of the file is written to standard output
tail -n 5 file name to view a few lines of
tail -f error.log constantly refresh to see the latest content
ps check process (dynamic)
-ef shows all running processes and displays the command to start the process of
netstat View network status (net status shorthand)
netstat-APN View all ports
an, according to a certain order output
p, which represents progress in the call display
| (Shift + next vertical line text input state on the keyboard | \) pipe character
is established between a command pipeline, output of the previous command as input commands back
to find tomcat process the command: ps -ef | grep tomcat
by command to find the process to take up this port number: netstat -apn | grep 8080
echo print the file or edit the contents of the file content
commonly used options are:
-n output does not wrap
-e can use the escape character (\ n carriage return, \ t tab key)
Example:
echo "Studying the I AM Linux" >> xujun.txt additional end of the file contents
echo $? If the return value is 0 when a command indicating success. If it is 1 to 255, then a failure
echo -e "wo \ tshi \ tshei "> xujun.txt
touch create a blank file, if the current directory has the same file, the file is updated timestamp
-a modified access (access) time
-m modify modify (amend) time to understand these two parameters
Viewing System uname
-m to view the system is several operating systems
-r view the system's kernel version
-a view detailed system kernel version of the operating system and system
Upload rz
If there is not the command system, installed using yum install lrzsz
-y cover
direct input rz, you can upload files
sz download
if there is no system of this command, use the install yum install lrzsz
-y cover
sz -y test.txt
switch user su
su root
View history Command History
chmod command privileges granted
-R permissions for all files and subdirectories under the directory recursively changed
digitally: r = 4 w = 2 x = 1
chmod 777 lemon
tar decompression, compression tar.gz
takes -czvf test.tar.gz test
The test folder compressed into test.tar.gz
tar-xzvf test.tar.gz
The test.tar.gz unpack test folder
extract the zip, zip compression
zip –r test.zip test
The test folder compressed into test.zip, r will have to bring the documents into compressed, or will generate an empty folder
unzip test.zip
Unzip the folder test.zip
Turn off the firewall
Open: service iptables start
shut down: service iptables stop
Permanently turn off the firewall
is turned on: chkconfig iptables on
close: chkconfig iptables off