Common centos commands

Source: Internet
Author: User

Common centos commands

Create a directory: mkdir-p [directory name]

Open Directory: cd [directory name]

(1) cd ~ Enter the Home Directory of the current user

(2) cd-enter the last directory

(3) cd .. go to the upper-level directory

(4) cd. Enter the current directory

View the current path: pwd

Delete Directory: rm-rf [directory name] (rm can only delete empty directories)

Copy: cp [Option] [directory or file] [target directory]

(1)-r: copy the Directory

(2)-p: copying the associated file attributes

(3)-d: if the source file is a linked file, copy the link property.

(4)-a: equivalent to-pdr

Cut or rename: mv [original file or directory] [target directory]

Link command: ln [original file] [target file]

-S: Create a soft connection

Differences between hard and soft links:

Hard link: it uses the same I node and storage and block as the original file. It can be seen as the same file. It can be identified by the I node and cannot be used across partitions or directories.

Soft connection: the soft connection has its own I node and block, but the block only saves the file name and node number of the source file, and file data with no time. Modify any file. Delete the source file. The soft connection is unavailable. Similar to windows shortcuts.

File Search command:

Locate [file name]

Find [range] [condition]

-Name: search by name

-Mtime: search by modification time

-Atime: search by file access time

-Ctiem search by file attribute change time

Grep [Option] [String] [file name]

-I case-insensitive

-V exclude specify exclude specified string

The difference between the locate, fand and grep commands:

Locate: quick search. It only searches for databases with the path "/var/lib/mlocate ".

Find: it is more flexible than locate. You can customize search conditions and search for files of the same type using wildcards.

Grep: searches by matching string and uses regular expressions for include matching.

Command SEARCH command:

Whereis command

-B: Only find executable files.

-M: Only search for help files

Which command

Differences between the whereis and which commands:

Whereis: path of the search Command and location of the help document

Which: the path of the search command and Its alias

HELP command:

Man [goal]

[Command] -- help

Help [command] (only for shell internal commands)

Compression and decompression commands:

Zip [compressed file name] [source file]

-R: Used to compress Directories

Unzip (extract)

Gzip [source file]

-R: Used to compress Directories

Gzip-d compressed file (decompress)

Shutdown and restart command:

Shutdown

(1)-c: cancel the previous shutdown command

(2)-h: Shutdown

(3)-r: restart

Log out command: logout

Mount command: mount [-t file system] [-o Special options] [device name] [mount point]

Edit command: vi [path]

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.