Linux File and directory management

Source: Internet
Author: User

View and switch directories

pwd --command to view the current working directory

650) this.width=650; "title=" 1.png "alt=" wkiol1pj7rtiqm6uaacoopf4vng255.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 3f/80/wkiol1pj7rtiqm6uaacoopf4vng255.jpg "/>

CD --Switch working directory

650) this.width=650; "title=" 2.png "alt=" wkiol1pj7x3jcxd5aacxa_dq_mo039.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 3f/80/wkiol1pj7x3jcxd5aacxa_dq_mo039.jpg "/>

Use a dot number "." Start with a clear indication that the current working directory is the starting point

Use two dots to start with "..." Represents the top-level directory under the current directory

Begins with a "~ User name", indicating that the specified host directory is the starting point, and that "~" is used to represent the current user's host directory.

ls --list displays the contents of the Catalog

- L : Displays a list of directories in long format, including permissions, size, last update time, and more.

-A : Displays all subdirectories and file information, including the name with the dot number "." Start with hidden directories and hidden files

-A : Similar to the-a option but does not display the "." Representation of the current directory, which represents the "." of the parent directory.

- D : Displays the properties of the directory itself instead of displaying the contents of the directory.

- H : Displays the size of the directory or file in a humane way, the default file size is bytes, and the K,m unit is displayed when you use-H. This option needs to be used in conjunction with-L.

- R : Recursively displays all content in the specified directory's extremely subdirectories.

--color : In character mode, different files are distinguished by color, and if you use--color=tty, the color scheme that the terminal wants to define is used. Generally: Dark blue indicates a directory, white represents a generic file, green indicates an executable file, * * * indicates a device file, and red indicates a compressed file.

650) this.width=650; "style=" Float:none; "title=" 1.png "alt=" wkiol1pj7figt_t9aadfxx_jufo601.jpg "src="/HTTP/ S3.51cto.com/wyfs02/m01/3f/80/wkiol1pj7figt_t9aadfxx_jufo601.jpg "/>

650) this.width=650; "style=" Float:none; "title=" 2.png "alt=" wkiol1pj7fjdkdjaaabp0w9oglo255.jpg "src="/HTTP/ S3.51cto.com/wyfs02/m01/3f/80/wkiol1pj7fjdkdjaaabp0w9oglo255.jpg "/>

650) this.width=650; "style=" Float:none; "title=" 3.png "alt=" wkiom1pj7n7gcx3-aakr8otklj4972.jpg "src="/HTTP/ S3.51cto.com/wyfs02/m00/3f/80/wkiom1pj7n7gcx3-aakr8otklj4972.jpg "/>

du --The space occupancy of the statistical catalogue and documents.

-A : Statistics disk space consumption includes all files, not just directories

- H : Display statistical results in a humane way

- S : Only the amount of space occupied by each parameter is counted, not each subdirectory.

Displays the amount of space that all files in a folder occupy.

650) this.width=650; "title=" 1.png "alt=" wkiom1pj7t6cedl5aabd0kclwzm131.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 3f/80/wkiom1pj7t6cedl5aabd0kclwzm131.jpg "/>

Displays the amount of space each file occupies

650) this.width=650; "title=" 2.png "alt=" wkiom1pj7uqqks0kaad_m4gqbww562.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 3f/80/wkiom1pj7uqqks0kaad_m4gqbww562.jpg "/>

mkdir --Create a new directory

650) this.width=650; "title=" 1.png "alt=" wkiol1pj7xrxijftaacibwz_jpa232.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 3f/80/wkiol1pj7xrxijftaacibwz_jpa232.jpg "/>

If you need to create nested multi-level catalogs, you must combine the "-P" option to create only one subdirectory.

Touch --Create an empty file

650) this.width=650; "title=" 2.png "alt=" wkiol1pj7yostslhaacautkffh4058.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 3f/80/wkiol1pj7yostslhaacautkffh4058.jpg "/>

If the destination file already exists, the time stamp for the target file will be updated.

LN Create a connection file

The connection file is divided into soft and hard links, the difference is that after deleting the original file, the soft connection will expire, but the hard link is still available: Soft connection trial and file or directory, but hard connection can only be used for files, cannot establish a hard connection for the directory.

The default is to create a hard link.

- S : Creating a soft connection

650) this.width=650; "title=" 3.png "alt=" wkiom1pj7jybwcp7aacok2y7qgw099.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 3f/80/wkiom1pj7jybwcp7aacok2y7qgw099.jpg "/>

CP --Copy files or directories

- F : Overwrite the target file or directory with the same name without reminders, and force replication directly.

- I. : Alerts the user to confirm when overwriting a file or directory with the same name

- P : Preserve the permissions of the source file while copying, the property is the same as the main and time tag.

- R : Copying a directory is a must using this option, which means recursively copying all files and subdirectories.

RM --Delete files or directories

- F : No reminders when deleting files or directories.

- I. : Alerts users to confirm when deleting files or directories.

- R : This option must be used to delete the directory, which means that the entire directory tree is deleted recursively.

MV --Move files or directories

650) this.width=650; "title=" 4.png "alt=" wkiom1pj7otxd_ynaadhkgbsxig174.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 3f/80/wkiom1pj7otxd_ynaadhkgbsxig174.jpg "/>

which --command to find the Linux command file and display the location.

650) this.width=650; "title=" 5.png "alt=" wkiol1pj78oq5tjaaabgdcvhgfg155.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 3f/80/wkiol1pj78oq5tjaaabgdcvhgfg155.jpg "/>

Find --Find files or directories

Find by Name: keyword "-name", based on the name of the target file to find, allow the use of "*" and "? "Wildcard character.

Find by file size: the keyword "-size" generally uses the +-sign setting to be more than or less than the specified size as a lookup condition. The common capacity units include k,m,g.

Find by file property: The keyword is "-user" and is searched based on whether the file belongs to the target user.

Search by file type: The keyword is "-type", ordinary file (f), directory (d), block device file (b), character device file (c), etc.

650) this.width=650; "title=" 6.png "alt=" wkiol1pj8axwk714aacj1cfimmi904.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 3f/80/wkiol1pj8axwk714aacj1cfimmi904.jpg "/>

Cat --Display and connect file contents

650) this.width=650; "title=" 7.png "alt=" wkiom1pj7yty1akuaagy3_1gyce548.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 3f/80/wkiom1pj7yty1akuaagy3_1gyce548.jpg "/>

More and less--page to view the contents of the file

More displays the percentage of the current number of pages less is not displayed.

Press the SPACEBAR to turn down a screen, press the B key up one screen, press the Q key to exit.

650) this.width=650; "title=" 8.png "alt=" wkiol1pj8khbgrhiaad24anldpk905.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 3f/80/wkiol1pj8khbgrhiaad24anldpk905.jpg "/>

Head and tail--Viewing the beginning or end of a file

Parameters can be specified using-N, and only 10 rows are displayed by default if no parameter is specified

Show the contents of line fourth

650) this.width=650; "title=" 9.png "alt=" wkiom1pj78rjejceaab6mnap3hi627.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 3f/80/wkiom1pj78rjejceaab6mnap3hi627.jpg "/>

WC --count the number of words in the content of the file

- C : Statistics The number of bytes in the file contents

- L : Number of rows in the statistics file contents

- W: count the number of words in the content of the file

The default of three options are

650) this.width=650; "title=" 11.png "alt=" wkiol1pj8qwar_epaabtj6ywkd0709.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 3f/80/wkiol1pj8qwar_epaabtj6ywkd0709.jpg "/>

grep --Retrieve filter file contents

- I.: ignores case when finding content.

- v : Flip lookup, which outputs rows that do not match the search criteria.

650) this.width=650; "title=" 20.png "alt=" wkiol1pj8ugtr7xoaab2ar9bkpu996.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 3f/80/wkiol1pj8ugtr7xoaab2ar9bkpu996.jpg "/>

This article is from the "Flying Ice" blog, please be sure to keep this source http://wangjunkang.blog.51cto.com/8809812/1440165

Linux File and directory management

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.