Linux Common commands

Source: Internet
Author: User
Tags parent directory disk usage

1, PWDCD

  function : Displays the absolute path of the current working directory

2. cd

  function : Switch to the established directory

  format : cd destination directory

  Example : Cd/root

  Remark :

CD (or CD ~) to quickly switch to the current user's host directory

Cd.. Switch to the upper-level parent directory of the current directory

CD-Quickly switch to the previous directory

3, LS

  features : Displays the contents of the development directory, displaying information about directories and files

  format : ls [options] directory or file

  Options :

-l display in long format verbose mode

-h displays in a user-friendly way (adds a file or directory size unit)

-a displays all directories or files (including hidden files or directories)

-D displays information about the directory itself

-R recursively displays information about hierarchical directory structures

4, mkdir

  function : Create an empty directory at the specified location

  format : mkdir directory Name

  Options :

-P Create hierarchical directory structure

-V shows the process of creating a directory

5. Du

  function : Disk usage of the statistics directory

  Options :

-s display in summary form

-a displays in detail

-H humanized plus unit

6. Touch

  function : Create an empty file at the specified location

  format : Touch file name

7. File

  function : View the type of the specified file

 format : File file name

8. CP

  function : Copy a file or directory to a specified location

  format : CP [option] source file destination file

  Options :

-R replication in a recursive manner

-p copy preserves the properties of the source file or directory (such as timestamps, etc.)

9, MV

  function : Move a file or directory to a specified location (renaming a file or directory)

  format : MV Source file Destination file

10, RM

  function : Delete the specified file or directory

  format : RM [Options] File name

  Options :

-R Recursive Delete (delete directory)

-F Force Delete

-V Show processing process

11, which

  function : View the location and path of the specified command file

  eg: which find

12. Find

  function : Search for files by criteria

  Options :

-name Search by file name

-user Search by the owner of the file

-type Search by file type

B-block devices (e.g. hard drives)

C-character devices (such as keyboards)

F General Documents

Catalog D

L Link File

Note: The Find criteria section combines-a (with) and-O (or) to find

13. Cat

  function : Display the contents of a text file

  Options :

-B number of non-empty lines

-N to all lines number

14, more

  features : page-by-row display of text file contents

  Operation :

SPACEBAR: Turn down one page

B: Turn up one page

Enter: Turn down one line

/string: Searches down the specified character in the displayed content

F: Displays the file name immediately and the number of rows currently displayed

Q: Exit

15. Less

  function : Display text file contents in pagination form

  Operation :

SPACEBAR or PageDown: Turn down one page

PageUp: Turn up one page

/string: Searches down the specified string

Q: Exit

16. Tar

  function : Backup archive for a directory or file and can be restored

  Options :

C: Create an archive file (backup)

X: Unpack Archive (Restore)

F: Archive (must be followed when creating an archive or unlocking an archive)

V: View progress Information

Z: Call gzip for compression or decompression

J: Call bZIP for compression or decompression

T: View the contents of the archive package

-C: Release the contents of the archive file to the specified directory (without default release to the directory)

17, tail

  function : View the penultimate end of a text document

  Options :

-F for monitoring file growth

-c number reads the specified file from the number byte location

-N number reads the specified file from the number line position.

-m number reads the specified file from the multiple-byte character position, for example, if your file assumes that you include Chinese characters, it is assumed that specifying the-c parameter may result in truncation, but using-m avoids the problem.

-B number reads the specified file from the 512-byte block position represented by number.

-K number reads the specified file from the 1KB block position represented by number.

file specifies the object name of the operation

In the above command, the number is involved, assuming that it is not specified, 10 rows are displayed by default. Number is preceded by a sign that indicates whether the offset is calculated from the top or from the tail.

18. WC

  function : Count the number of lines, bytes, and words of a text file

  Options :

-L Number of rows

-W Number of words

-C byte number

19. grep

  function : finds a specific string in the specified file

Option :-V   Reverse selection

  remarks : ^ indicates what to start with

$ indicates what to end With

^$ represents a blank line

Linux Common 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.