(1) Command ls--list files
Ls-la gives a long list of all the files in the current directory, including a "hidden" file that begins 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 convenience, the-a option contains the-r option
Cp-i ask the user before overwriting
Cp-v tell users what they are doing
(3) command mv--to move and rename files
MV Aflie bfile Renaming afile to bfile
MV Afile/tmp Move the afile under the current directory to the/tmp/directory
(4) Command rm--delete files and directories
RM afile Deleting files Afile
RM * Deletes all files in the current directory (no hidden files). 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) Command cd--change 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) command mkdir--to create 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) Command mkdir--Delete directory
mkdir will delete empty directory
(8) command more, less--view the contents of the file
MORE/ETC/PASSWD viewing the contents of/etc/passwd
Features: Pagination display commands
More file
The more command can also be passed through the pipe character (|) Used with other commands, such as:
PS Ux|more
Ls|more
LESS/ETC/PASSWD viewing the contents of/etc/passwd
(9) Command 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) Command find--Find files
Find.-name *.rpm looking for RPM packages 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 file names that contain traceroute files anywhere on the system
(11) Command vi--Edit file
Vi/etc/bubby.txt editing files with VI/etc/bubby.txt
Vim/etc/bubby.txt editing files with VI/etc/bubby.txt
Quick action:
Toggle window: alt+1,alt+2
Fullscreen: ALT + ENTER
Hold vim Up (pause): Ctrl + Z, pause after other shell operation, after the end can be switched back to the Vim interface via FG command to continue editing
: MR: View History file Record (note: Mr Capitalization)
: SP Landscape Switch Interface window: VSP Vertical Switch Interface window facilitates multi-file control coding (e.g.:)
Emacs/etc/bubby.txt editing files with Emacs/etc/bubby.txt
(12) Order RZ, sz--file upload download
Run the command sudo rz, that is, to receive the file, Xshell will pop up the file selection dialog box, select the file and close the dialog box, the file will be uploaded to the current directory in Linux.
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 no longer open FTP service.
(13) Command cat--display file contents
Cat file
(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.
Use 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
Parameters:
-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 Man 7 signal:
-1: Re-read the parameters of the configuration file (similar to reload);
-2: Represented with the same action by keyboard input [ctrl]-c;
-9: Immediately forcibly delete a job;
-15: Terminate a job in a normal program manner. And-9 are 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 down 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
TAR-XVF **.tar a.jsp B.java **.tar Unpacking
(20) Command tail--view file details
Tail-f Aaa.txt See more information of aaa.txt file
Tail-n x Aaa.log x: Last few lines
(21) Command head--view the name and suffix of the file
Head-n x Aaa.log 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 compares the file list of directory 1 with directory 2, but does not compare the actual contents of the file, but lists
diff file1 File2 Compare file 1 with the contents of file 2 is the same, if it is a text format of the file, it will be different content display, if the binary code only means that two files are not the same
Comm file1 file2 comparison file showing two different files
(23) command ln--to establish a connection
ln source_path Target_path Hard Connection
Ln-s source_path Target_path Soft Connection
(24) command touch--create an empty file
Touch Aaa.txt creates an empty file with a file name of Aaa.txt
Iii. Basic System commands
(25) Command man--to view Help for a command
Man LS display Help content for LS command
(26) Command w--display details of the logged-in user
sarge:~# W
(27) Command who--show logged in user
sarge:~# who
(28) Command last--View recent user Login 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
Settings for the time zone
# Tzselect
Please identify a, so, time zone rules can be set correctly. Please select a continent or ocean
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
Pacific Ocean
One) None-i want to specify the time zone using the Posix TZ format.
Input 5, Asia
Please select a country
1) Afghanistan
) Israel
Palestine)
2) Armenia
Japan
Philippines)
3) Azerbaijan
Jordan
Notoginseng) Qatar
4) Bahrain
) Kazakhstan
Russia)
5) Bangladesh
Korea (north)
) Saudi Arabia
6) Bhutan
Korea (south)
Singapore)
7) Brunei
) Kuwait
) Sri Lanka
8) Cambodia
Kyrgyzstan)
) Syria
9) China
Laos)
Taiwan)
) Cyprus
Lebanon)
Tajikistan)
One) East Timor
MACAU)
Thailand)
Georgia)
) Malaysia
(Turkmenistan)
Hong Kong
Mongolia)
) Arab Emirates
India)
Myanmar (Burma)
Uzbekistan)
Indonesia)
Nepal)
) Vietnam
Iran)
) Oman
Yemen)
Iraq)
Pakistan)
Input 9, China
Please select one of the following time zone regions
1) East China-beijing, Guangdong, Shanghai, etc.
2) Heilongjiang
3) Central China-gansu, Guizhou, Sichuan, Yunnan, etc.
4) Tibet & most of Xinjiang Uyghur
5) southwest Xinjiang Uyghur
Input 1, GMT
The following information has been given:
China East China-beijing, Guangdong, Shanghai, etc
Therefore tz= "Asia/shanghai" would be used. Local time is Now:fri Jul 7 10:32:18 CST 2006.Universal time is Now:fri Jul 7 02:32:18 UTC 2006.Is The above information ok?1) Yes2) No
Enter 1 to confirm
If you do not use the Tzselect command, you can modify the file change time zone.
# Vi/etc/sysconfig/clock Zone=asia/shanghai (check/usr/share/zoneinfo file below) Utc=false Arc=false
# Rm/etc/localtime
# Ln-sf/usr/share/zoneinfo/asia/shanghai/etc/localtime
Reboot.
(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 shutting down the computer
Generally with Shutdown-r now, in rebooting the system is to close the related services, Shutdown-h now is also the case.
(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
Change the owner or group of a file or directory
Chown-r-H owner File
The-R (recursive) option means that the same operation is done for files in all subdirectories.
-h option means that changing the owner of a symbolic link file does not affect the target file that the link points to
Chown-r xh test1 (all files in Test1 directory and subdirectories become XH)
1. Review the process number to restart the process
Ps–ef|grep xxxx
2. The process of killing the project
Kill the second column first, then the first column.
Sudo kill-9 x x
(x is the process number, while killing multiple middle spaces separated by a space)
3. Restart Tomcat
Find the Bin directory of Tomcat first
Cdtomcat/bin;
Then run sudo./run.sh to start Tomcat.
Maven Package statement: MVN clean package–dmaven.test.skip=true
Modify language
vi/etc/sysconfig/i18n modifying a Linux language such as: language= "zh_en" uppercase to lowercase enesc,:wqsource/etc/sysconfig/i18n
#查找不知道目录的文件
Find-name/"Name"
System
1. # view kernel/Os/cpu information
# uname-a
2. # View OS Version
# head-n 1/etc/issue
3. # View CPU Information
# Cat/proc/cpuinfo
4. # View Computer name
# hostname
5. # List all PCI devices
# LSPCI-TV
6. # List all USB devices
# LSUSB-TV
7. # List Loaded kernel modules
# Lsmod
8. # View Environment variables
# env
Resources
9. # View memory usage and swap area usage
# free-m
10. # View the usage of each partition
# df-h
11. # View the size of the specified directory
# du-sh < directory name >
12. # View Total Memory
# grep Memtotal/proc/meminfo
13. # View the amount of free memory
# grep Memfree/proc/meminfo
14. # View System uptime, number of users, load
# uptime
15. # View System load
# Cat/proc/loadavg
Disks and partitions
1. # View the status of the attached partition
# Mount | Column-t
2. # View all partitions
# fdisk-l
3. # View all swap partitions
# swapon-s
4. # View disk parameters (for IDE devices only)
# hdparm-i/dev/hda
5. # View IDE Device detection status at startup
# DMESG | grep IDE
Internet
1. # View the properties of all network interfaces
# ifconfig
2. # View firewall settings
# iptables-l
3. # View Routing Table
# Route-n
4. # View All listening ports
# NETSTAT-LNTP
5. # View all established connections
# NETSTAT-ANTP
6. # View Network Statistics
# netstat-s
Process
1. # View All Processes
# PS-EF
2. # Real-time display of process status
# Top
User
1. # View Active Users
# W
2. # View specified user information
# ID < user name >
3. # View User login log
# last
4. # View all users of the system
# cut-d:-f1/etc/passwd
5. # View all system groups
# cut-d:-f1/etc/group
6. # View Current user's scheduled tasks
# crontab-l
Service
1. # List all system services
# chkconfig--list
2. # list all startup system services
# chkconfig--list | grep on
View Port Netstat–an
Netstat-ano + tasklist/svc
Netstat-ano lookup port corresponding PID tasklist/svc based on PID lookup service
Netstat-tuln | grep 17002 Viewing port conditions
Program
1. # View all installed Packages
# RPM-QA
Find recently modified files with the Find command
Apache lsof-i:80
Chkconfig--list View Service
Apache Restart command: Service httpd start
Service httpd Restart Restart
Service httpd Stop Services
Installing the JDK
[Email protected] software]# chmod u+x jdk-6u31-linux-x64-rpm.bin
[Email protected] software]#./jdk-6u31-linux-x64-rpm.bin
[Email protected]/]# Vi/etc/profile
Export java_home=/usr/java/jdk1.6.0_31
Export JRE_HOME=/USR/JAVA/JDK1.6.0_31/JRE
Export path= $JAVA _home/bin: $JRE _home/bin: $PATH
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
[Email protected]/]# Source/etc/profile
[Email protected]/]# java-version
Java Version "1.6.0_31"
Java (TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot (TM) 64-bit Server VM (build 20.6-b01, Mixed mode)
############## #linux命令相关 ###################################
Compression: (package name before compression of package name)
TAR-ZCVF union.kuche.com_20120209.tar.gzunion.kuche.com
Mobile: (move packaged package into/opt/back/web/directory)
MV union.kuche.com_20120209.tar.gz/opt/back/web/
Extract:
TAR-XZVF union.kuche.com_20120209.tar.gz
Copy
Cp-a union.kuche.com union1.kuche.com
Delete
RM-RF union.kuche.com
#启动VPN命令
Execute command: Service OpenVPN start
#修改工作目录
vi/etc/passwd
Modify the Linux language to change the question mark to a font (not for general modification language)
View language: cat/etc/sysconfig/i18n
Write all other comments out of the i18n configuration file
Lang= "ZH_CN. UTF-8 "
Sysfont= "Latarcyrheb-sun16"
Modify Server login Password: passwd
SUSE Linux Common commands