This article General reference: http://blog.csdn.net/xiaoguaihai/article/details/8705992/
2. User Management Operation command
(1) SU-XX Switching users
3. File Management Operation command
(1) LS lists the contents of the directory
Ls-a View All Files
Ls-l to view detailed properties
File View Files Type
(2) CD switch directory
CD.. Return to previous level directory
cd– go back to the directory you just
Cd~ back to the root directory
(3) mkdir Create a new directory
Mkdir-p./mengx/dir Create directory Mengx/dir directory under current directory
-p ensures that the directory name exists and creates a new one if the directory does not exist. You can create multi-level catalogs directly
It is not recommended to use the-P option, because you are worried that if you typo, the directory name will become messy.
Mkdir–m 711 Test2 Establish a directory with permissions of 711
-m configuration file permissions. If it is not specified, it is the default property. Umask
(4) Touch filename Creates a file or modifies the archive time
Touch Files Create files
Touch–d "2 days ago" file to adjust the file date to 2 day ago
(5) RM Delete directory or file
Rm–r/temp/etc the/TEMP/ETC and the contents of the directory are removed.
Rm–f Xxx-f is force, ignoring nonexistent files, forcing deletion without warning
Rm–i Xxx-i will ask whether to confirm the deletion before deleting.
Rm–i A * * represents 0 to infinity of any number of characters. Represents the removal of all files starting with a in the execution command directory
(6) rmdir Delete empty directory
(7) CP copy
CP file. --Copy the file to the current directory
CP File/usr/men/tmp/file1-- copy file to directory/usr/men/tmp and rename to File1
Cp-r/usr/men/usr/zh--Copy all files and their subdirectories under directory/usr/men to the directory/usr/zh
By default, the CP command cannot replicate the directory, and the-r option must be used if you want to copy the directory;
(8) MV Mobile
MV File 1 file 2 destination directory
(9) Vifilename file Edit command (enter command line mode )
I insert command (enter insert mode, editable)
ESC exits the Insert state (back to command-line mode)
: Wq Save File Exit command
: wq! Save and eject (file owner ignores file read-only attribute)
: Q exit
: q! Do not save exit
PWD Displays the current directory
(one) chown change file owner
Chown-r Account name File
Chown-r account Name: Group name file
-R is a recursive modification, and all documents in this directory are changed
(chmod) Change the permissions of the file
A. number types change document permissions:
4 (Read), 2 (write), 1 (performed)
In the form of a three-bit octal number, the first bit specifies the owner's permission, the second bit specifies the group permission, and the third specifies the permissions of the other user
B. symbols change document permissions
Who:u User, G Group, o Other, a All users all (default)
OpCode opcode: + add permissions,-delete permissions, = Reassign permissions (SET)
Permission permissions: R-Read, W-write, X-Execute
à Example:
$chmod u+x file adds execute permission to the owner of file
$chmod 751 file assigns read, write, execute (7) permissions to the owner of file, assigns read, execute (5) permissions to the group where the file is located, and assigns permissions to other users to execute (1)
$chmod another form of the U=rwx,g=rx,o=x file example
$chmod =r file to assign Read permissions to all users
$chmod 444 File Above example
$chmod a-wx,a+r File above example
$chmod-R u+r directory recursively reads permissions for the owner of all files and subdirectories under the directory directory
$chmod 4755 sets the ID, assigns read, write and execute permissions to the owner, and assigns read and execute permissions to the group and other users.
Chmod–r 777 Test.txt
-R is to modify directory permissions, recursively modify other file permissions in the folder
() umask File preset permissions
Umask is the "take away" of the corresponding bit from the permission. That is, 777 minus the value of umask, which gives the document permission
When the catalog is created, read R (4), write W (2), and execute X (1) Permissions can be assigned to
Cannot give execute permission x (1) when file is created. This permission must be added after creation with the chmod command
Example: Umask 022. The created directory (mkdir) permission is 755. The file is 644 because there is no execute permission on the created file (touch)
Umask file directory:
022 644 755
027 640 750
002 664 775
006 660 771
007 660 770
Local search for a specific name file
local-i keyword to find all keyword-related filenames in the system
() Find search for a specific time file
Find-/-mtime 0 0 represents the current time. Documents that have changed from now until 24 hours ago
(+) gzip and decompress zip files
[[email protected] test6]# gzip*--Compress each file in the Test6 directory into a. gz file
[[email protected] test6]# gzip-v man.config--Compress man.config file
[[email protected] test6]# GZIP-DV *--Each compressed file is decompressed (-D), and detailed compression ratio information (-V) is listed
The BZIP2 command is used to create and manage (including unzip) compressed packages in the ". bz2" format
A. Compressing the specified file
Bzip2filename
Bzip2-zfilename here, the compression will not be output, the original file filename is deleted, replaced by filename.bz2. If you have a previous filename.bz2, you will not replace and prompt for an error (Specify the-F option if you want to replace, for example, Bzi P2-ffilename; If filename is a directory, it also reminds the error not to do anything; if filename is already pressed, there is a bz2 suffix to remind that no more compression, no bz2 suffix will be compressed again.
B. Extracting the specified file
bzip2-dfilename.bz2
BUNZIP2FILENAME.BZ2 here, the decompression when there is no standard output, will be the original file filename.bz2 to replace the filename. If there is a previous filename, then the error is not replaced (specify the-F option if you want to replace, such as BZIP2-DF filename.bz2.
(+) tar package files and directories into a single file: It is useful for backing up files or combining several files into a file for network transmission.
BUNZIP2FILENAME.BZ2 here, the decompression when there is no standard output, will be the original file filename.bz2 to replace the filename. If you have previously
Package all the files into a tar package:
Tar-cvflog.tar Log2012.log only packaged, not compressed!
tar-zcvflog.tar.gz Log2012.log after packing, compress with gzip
TAR-JCVFLOG.TAR.BZ2 Log2012.log is packaged to bzip2 compressed
The file name after option F is taken by yourself, and we are accustomed to using. Tar as an identification. If the z option is added, a. tar.gz or. tgz is used to represent the gzip compressed tar package, or the. tar.bz2 as the TAR package name if the J option is added.
Reference: Http://man.linuxde.net/tar
Packaging refers to a large number of files or directories into a total file, compression is a large file through some compression algorithm into a small file. Many of the compression programs in Linux can only be compressed for one file, so when you want to compress a lot of files, you have to first make a package (tar command) of this large number of files, and then compress the program (GZIPBZIP2 command).
4. System Management Commands
(1) PS displays a list of processes running by that user in the current system
PS-EF View all processes and their PID (process number), System time, command details directory, performer, etc.
(2) The program running in top dynamic display system (usually every 5s)
Top Displays the current process
Q exit the Show Process page
Top-i only show active processes
(3) kill outputs a specific signal to the process of the specified PID (process number)
Kill 11 Abort process with process number 11
(4) Clear erase screen
(5) Shutdown shutdown
Restart restart
5. Common Hotkeys
(1) TAB command Completion function
(2) Ctrl + C Stop the current running program
(3) Ctrl+d represents the end of the keyboard input meaning. Can replace exit
6. System commands
(1) Date display dates
Cal Display Calendar
Http://blog.sina.com.cn/s/blog_8a489d810102wjz6.html
1.1 Finishing the Linux Foundation