suse Linux Common commands
(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 (|) In conjunction with other commands,
For example:
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 in the main Apache configuration file, find all non-comment lines (10) command find--Find files
Find.-name *.rpm looking for RPM packages in the current directory
Find. | grep page looks up the file name in the current directory and its subdirectories that contains the page files locate traceroute anywhere on the system find file names that contain traceroute files
(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
Convenient multi-file control code (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 send file to Windows (saved directory is configurable)
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
(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
Parameter:-L: This is the lowercase of L, which lists the current signals (signal) that kill can use? A total of 62
Signal.
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 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
Make 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 the Aaa.txt file for more information 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) Order
clock--Clock Settings
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 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 Ps–ef|grep xxxx 2 to restart the process. Kill the process of 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
First find the Tomcat bin directory Cd Tomcat/bin;
Then run sudo./run.sh to start Tomcat.
SUSE Linux Common commands