Linux instructions (Directory class operation instructions)

Source: Internet
Author: User
Tags disk usage

Pwd

Displays the current working directory

CD target directory such as Cd/boot/grub

Switch to a directory from the current directory

CD

Switch to the root directory

Cd..

Switch to the upper-level directory of the current directory

ls Displays the contents of the current directory

ls [options] directory or file

ls-l/etc/passwd Show details under ETC/PASSWD file

ls-ld/root Show details in current directory

-A show all files and contents

-l display in a long-format verbose manner

-h display in a user-friendly way (add a file or directory size unit)

-D displays information about the directory itself

-R recursive display of hierarchical directory structure information

mkdir creating an empty directory at the specified location

Option:-P Create a hierarchical directory structure

-V shows the process of creating a directory

Mkdir-p/1/2/3 Create a hierarchical directory at/below

mkdir movie Create a movie directory in the current directory

Mkdir/music Create a music directory under the root directory

Du

Disk usage of the statistics directory

Format: Du option directory Name

Option:-S to display in summary form

-A is displayed in detailed form

-h display in a humane way

Du-ah/music shows the disk space occupied by all files in this directory

Du-sh/music shows the disk space occupied by this directory (total)

Touch

Function: Create an empty file at the specified location

Example: Touch Qingshu creating an empty file in the current directory

Touch/tmp/daxiongmao creating a Daxionmao file in the/tmp directory

Date

Time to display the system

File

Function: View the type of the specified file

Example: FILE/ETC/PASSWD View the type of the file

Cp

Function: Copy a file or directory to the target directory

Format: cp[option] source file or directory destination directory

or cp[option] source file or directory destination file

Option:-R to recursively copy

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

Example:

Cp/tmp/daxiongmao/music (Copy the Daxiongmao file to the Music folder)

Cp/tmp/daxiongmao/music/temp (Copy the Daxiongmao file to the Music folder and rename it to TEMP)

Cp-r/tmp/*/music (copy all files under the TMP directory and each subset directory to the music folder)

Mv

Function: Move a file or directory to the target directory

Format: cp[option] source file or directory destination directory

or cp[option] source file or directory destination file

Option:-R to move in a recursive fashion

-p move to preserve the properties of the source file or directory (such as timestamp)

Rm

Function: Delete the specified file or directory

Option:-R Recursive Delete (for deleting directories)

-F Force Delete

-I interactive Delete

-V Show processing process

Example: Rm/tmp/daxiongmao

Rm-rf/tmp (forced to delete content in directory and directory, careful operation preferably first data backup)

   

Find

Function: Search for files by criteria

Option:-name Search by file name

-user Search by user name

-type Search by file type

-size Search by File size

Format: Find find range Lookup criteria

Example: Find/etc-name *.conf

Find/etc-size +1024k (greater than 1024k)

Absolute path

The feature always starts with/begins with/boot/grub relative to/root directory

Relative path

Relative to the current path

It is recommended to use relative directories if there is a parent-child relationship between the current directory and the target directory, and the absolute path is recommended instead

Linux instructions (Directory class operation instructions)

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.