first, the Directory Processing command:1, LS
Command name: LS
Command English original meaning:list
directory where the command is located:/bin/ls
Function Description: Display directory file
Syntax: LS [-ald] [file directory]
-A (all) displays all files , including hidden files (the Linux hidden file settings are implemented by changing the name, and the name is prepended.)
-L (long) details display
-D View Directory properties (general and L use together)
-H User-friendly view ( general and L use together )
2, mkdir
Command name: mkdir
Command English original:make directories
directory where the command is located:/bin/ls
Function Description: Create a new directory
Syntax: mkdir [recursive p] [directory name]
-P Recursive Creation (if directory is created, you need to use-p)
3. cd
Command name: CD
Command English original meaning:change Directory
directory where the command is located:/BIN/CD
Function Description: Switch directory
Syntax: CD [directory name]
CD: Go back to the top level directory
4. pwd
Command name: pwd
Command English original meaning:print workding directory
directory where the command is located:/bin/pwd
Function Description: Displays the current directory path
Syntax: pwd
5, RmDir
Command name: rmdir
Command English original meaning:remove emtry directories
directory where the command is located:/bin/rmdir
Function Description: Delete Empty directory (if there is a file in the directory, is not deleted, so is to delete empty directory)
Syntax: RmDir file
6. CP
Command name: CP
Command English original:copy
directory where the command is located:/BIN/CP
Function Description: Copy files or directories
Syntax: cp-rp[original file or directory [target directory]
-R Copy Directory
-P Keep files or directories
7, MV
Command name: MV
Command English original meaning:movE
directory where the command is located:/BIN/MV
Function Description: Cut file, rename
Syntax: MV [original file or directory] [target directory]
8, RM
Command name: RM
Command English original meaning:remove
directory where the command is located:/bin/rm
Function Description: Delete file or directory
Syntax: MV [file or directory]
-R Delete Directory
-F Enforcement (regardless of the deleted directory thousands of files will be deleted at once, without prompting)
Second, the file Processing command: 1, touch
Command name: Touch
directory where the command is located:/bin/touch
Function Description: Create an empty file
Syntax: touch [filename]
Do not use spaces when creating files, if you want to use a space, you can use the ""
2. Cat
Command name: Cat
directory where the command is located:/bin/cat
Function Description: Display file contents
Syntax: cat [filename]
-N Display Line number
Suitable for viewing files with little content
3, more
Command name: more
directory where the command is located:/bin/more
Function Description: Pagination display content
Syntax: more [filename]
(space) or F page
(carriage return) line break
(q or Q) exit
Good for viewing files with more content, but once the page turns over, you can't page up.
4. Less
Command name: Less
directory where the command is located:/user/bin/less
Function Description: Pagination display content (can page up)
Syntax: less [filename]
It is suitable for viewing files with more content, and can support paging up in addition to all features of more.
5. Head
Command name: Head
directory where the command is located:/user/bin/head
Function Description: Displays the first few lines of the file
Syntax: head [filename]
-N Specify line number
6, tail
Command name: Tail
directory where the command is located:/user/bin/tail
Function Description: Displays the end of the file a few lines
Syntax: tail [file name]
-N Specify line number
7, Ln
Command name: LN
Command English original:link
directory where the command is located:/BIN/LN
Function Description: Generate link file
Syntax: ln-s [filename] [target file]
-S Create soft links
The difference between a hard link and a soft link (-s):
A hard link must be under the same partition and cannot be used for a directory, and a soft link has no relationship. A soft link is actually a shortcut to Windows.
Third, the Rights Management command: 1, chmod
Command name: chmod
Command English original:change the permissions mode of a file
directory where the command is located:/bin/chmod
Function Description: Change file or directory permissions
Syntax: chmod [{ugoa}{+-=}{rwx}] [filename] [destination file]
[mode=421] [File or directory]
-R Recursive modification
The number of permissions means: R (4), W (2), X (1), so we can also use numbers to represent permissions
2, Chown
Command name: Chown
Command English original meaning:change file ownership
directory where the command is located:/bin/chown
Function Description: Change the owner of a file or directory
Syntax: chmod [user] [file or directory]
Example: Chown hzg110 Japan changes the owner of a file for Japan hzg110
3, Chgrp
Command name: CHGRP
Command English original meaning:change file grouP ownership
directory where the command is located:/bin/chmod
Function Description: Change the owning group of a file or directory
Syntax: chgrp [user Group] [file or directory]
Example: CHGRP mygroup Japan change file Japan's owning group is MyGroup
Iv. File Search command: 1, find
Command name: Find
Command English original meaning: find
directory where the command is located:/bin/find
Function Description: File search
Syntax: Find [search scope] [match condition]
Example: Find/opt-name tomcat* (Find a file or directory with a name that starts with Tomcat under the opt file)
-iname: Not case-sensitive, * on behalf of all,? Represents a
Example two: find/opt/-name tomcat*-a-type D (-A for and is two conditions are satisfied with the-O representative satisfies any one can)
-type:f-Representative File D-Representative directory L-Soft link
2, locate
Command name: Locate
directory where the command is located:/user/bin/locate
Function Description: Search in a file vault
Syntax: Locate [match condition]
The difference between it and find: Locate is the search for the vault, find is real-time from the hard disk partition to go to a single search. The newly created file locate is not found.
To search for the file or directory you just created, use the UpdateDB command.
Example: Locate tomcat cannot use * or?
-I is case insensitive
3. grep
Command name: grep
directory where the command is located:/bin/grep
Function Description: Searches the file for string matching lines and outputs
Syntax: grep [Specify string] [file]
-I is case insensitive
-V excludes the specified string
Example one: Grep-i mysql/opt/tomcat/conf/123.conf (the row where the MySQL string is found in a 123.conf file is not case-sensitive)
Example two: Grep-v ^#/opt/tomcat/conf/123.conf (all lines in a 123.conf file except for lines that begin with #)
Iv. User Management commands: 1, Useradd
Command name: Useradd
directory where the command is located:/user/sbin/useradd
Function Description: Add new user
Syntax: Useradd user name
2, passwd
Command name: passwd
directory where the command is located:/user/sbin/passwd
Function Description: Modify user password
Syntax: passwd user name
3. Who
Command name: WHO
directory where the command is located:/user/bin/who
Function Description: View the logged in user's information
Syntax: WHO
PTS: Remote
4, W
Command name: w
directory where the command is located:/user/bin/w
Feature Description: View details of logged-in users
Syntax: w
Five, Compression decompression command: 1, gzip
Command name: gzip gunzip
directory where the command is located:/bin/gzip/bin/gunzip
Function Description: Compress the extracted files (cannot be directory)
Syntax: gzip files gunzip File
Do not retain the original file after compression
2. Tar
Command name: Tar
directory where the command is located:/bin/tar
Function Description: Package directory
Syntax: tar option [-zcf][compressed file name] [directory]
-C Packaging
-V Show More information
-F Specify File name
-Z Package simultaneous compression
File name suffix after compression:. tar.gz
Keep the original file after compression
Tar file decompression Syntax:
-X Unpack the package
-V Show More information
-F Specify File name
-Z Decompression
Example: TAR-ZXF cangjingkong.tar.gz
3, BZIP2
Command name: bzip2
directory where the command is located:/USER/BIN/BZIP2
Function Description: Compress file
Syntax: bzip2 options [-k][file]
-K retain original file after generating compressed file
Compressed file suffix:. bz2
Example: $bzip 2-k Boduo
$tar-CJF boduo.tar.bz2 Boduo
BZIP2 Decompression Syntax:
Command name: BUNZIP2
Example: $bunzip 2-k boduo.bz2
$tar-XJF boduo.tar.bz2
4. zip
Command name: Zip
directory where the command is located:/user/bin/zip
Function Description: Compress files or directories
Syntax: Zip option [-r][compressed file name] [directory]
-R Compression Directory
Compressed file suffix:. zip
Zip compression preserves the original file.
Vi. file Editing commands: 1, VIM
1. Vim file (enter preview mode)
2, press A, I, O can enter the editing mode
3. Press ESC to enter preview mode when finished editing.
4, press: Wq Save and exit or press: q! do not save exit
VII. Process Management Commands: 1, PS
The PS command is used to view the currently running process.
grep is a search
Example: Ps-ef | grep java
2. Kill
The KILL command is used to terminate the process
Example: kill-9 [PID]
-9 means the forced process stops immediately
Usually use PS to view the process PID, terminate the process with the KILL command
Eight, System shutdown command: 1, shutdown
Shutdown option Time
Options:
-C: Cancel the previous shutdown command
-H: Shutdown
-R: Restart
Linux Common commands