Summary of Common Linux commands

Source: Internet
Author: User
Tags bz2


[[Email protected]~]#
Root currently logged in user
LocalHost host name
~ Current Directory
# Super User's prompt
$ ordinary user's prompt

mkdir directory name Create a new directory
RM-RF directory can be deleted recursively
MV Original file directory destination directory
CD Directory name Enter directory
Cd. Enter Current user
Cd.. Go to the top level directory
CD-Go to last directory


UNAME-A display computer and operating system information
Cat/proc/version description of running kernel version
Cat/etc/issue shows the release version information

Plugin (Plug-in,addin,add-in,addon or add-on) is a computer application program that interacts with the main applications (host application)
To provide specific functionality. Can be said to be a plug-in. If you find the plugin folder under a folder in a program, it should be the plugin for this program.

chmod 777 FileName Modify file permissions
CP File name Directory
Ls-l listing the details of a file
PWD Displays the current directory
Cat Viewing documents
Touch modify file time or build new document
VI Editing files

Process command
PS View the currently running process
Kill End Process Kill-9 [PID]
Pstree displays the current process in a tree-shaped structure
Top Dynamic View process changes

Shutdown: Shutdown/halt/poweroff/init 0
Restart: Reboot/init 6
Exit Login: Logout

RunLevel Querying system Run level

Cat/proc/cpuinfo: View a Linux CPU
Cat/proc/meminfo: Viewing memory information
Cat/proc/swaps: View Swap partition information
DF-LH: Viewing hard disk information

U stands for user. File owner
G stands for Group. Permissions for the user group to which the file belongs
O Stands for others. Other users
A stands for all.

-rwxrwxrwx
The first-is the file type, D represents the directory, and L represents the soft link
421
Read Permissions 4
Write Permissions 2
Execute Permissions 1

Ln-s Original file Destination file Create soft link

Locate FileName File Search command
Whereis command name search the path to the system command and where the help document is located
Whatis command name-M only find help files

which filename search command path and alias

Find [Search scope] [search criteria] search the system for eligible file names, such as matching, wildcard matching, wildcard is a secure match
Find/-name Install.log
Find Root-iname Install.log
Find Root-user Root Search by Owner
Find/root-nouser find files with no owner, kernel-generated files may not have owner, can clear the file without owner

find/var/log/-mtime +10 to find Files modified 10 days ago
-10 in 10 days
10 10 days of modified files on the same day
-atime File access time
-ctime changing file properties
-mtime Modifying file contents

Find. -size 25k Find File size is 25k file
-25k less than
+25 Greater than

Find/etc-size +20k-a-size-50k-a and
-O or OR

String Search command grep
grep [Options] string file name matches a qualifying string in a file-I ignore size,-V excludes the specified string

Differences between Find and grep:
Find searches the system for eligible file names, wildcard matches, exact matches
grep searches the file for strings that match the criteria, and matches them with regular expressions, including matching

The man command gets help for the specified command
See LS for help if man ls
Man-f command to see what levels of Help the command has
Equivalent to the Whatis command

The Man-k command is equivalent to the apropos command

Command--help get help with command options, such as LS--help

Info Command verbose command help


Compress command

Common compression formats:. zip. gz. bz2
. tar.gz. tar.bz2

Zip format compression: Zip compressed file name source file #压缩文件
Zip-r compressed file name source directory #压缩目录

Zip Format decompression: Unzip compressed file #解压缩. zip file

GZ format compression: gzip source files #压缩为. gz format compressed files, source files disappear
Gzip-c source Files > Compressed Files # Compressed to. gz format, source files reserved
Gzip-r directory #压缩目录下所有的子文件, but cannot compress directory

GZ Decompression: gzip-d compressed file
Gunzip compressed Files/gunzip-r Compressed directory



BZ2 compression: bzip2 source file #压缩为. bz2 format compressed file, source file disappears
Bzip2-k source File #保留源文件
Note: BZIP2 cannot keep the compressed directory

BZ2 Unzip bzip2-d compressed file #解压-K reserved Compressed file
BUNZIP2 Compressed Files


Package TAR:TAR-CVF Package file name source file
C Package V Display procedure f Specifies the file name after packaging

Example: TAR-CVF 1.tar 1
You can package the directory as a. tar file, and then compress the directory

Unpack command: TAR-XVF package file name
X Solution Pack

such as TAR-XVF 1.tar

. tar.gz compression format: In fact, the. tar.gz format is packaged first as. Tar and then to. gz format
TAR-ZCVF compressed package name. tar.gz source File #-Z for compression to. tar.gz format
TAR-ZXVF compression name. tar.gz #-x for decompression. tar.gz format


. TAR.BZ2 compression format: TAR-JCVF [path] Compressed package name. tar.bz2 Source File
TAR-JXVF compressed package name. tar.bz2

Summary of Common Linux commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.