Linux Directory Operations Command

Source: Internet
Author: User

I. Directory management commands (mkdir, rmdir

The types of Linux files are:-: ordinary file case; d: directory file; b: block device file; C: Character device file; l: Link file; s: Socket file; p: Pipe file.

1. mkdir: Create directory (used for path base name, path name must exist before path base name)

mkdir [OPTION] ... DIRECTORY ...

OPTION:

-P: When creating a directory, the path name is created if the path before the base name of the path does not exist.

-V: Displays the process of creating the directory. Verbose

-M Mode: Set directory permissions when creating a directory, or default if the parameter mode is not given.


Extension 1: Create/tmp/x/y1,/tmp/x/y2,/tmp/x/y1/a,/tmp/x/y1/b

Method One: #mkdir/tmp/x/y1/tmp/x/y2/tmp/x/y1/a/tmp/x/y1/b-PV

Method Two: Use the command line to expand the mechanism:

[Email protected] tmp]# Mkdir/tmp/x/{y1/{a,b},y2}-PV

mkdir: The directory "/tmp/x" has been created

mkdir: The directory "/tmp/x/y1" has been created

mkdir: The directory "/tmp/x/y1/a" has been created

mkdir: The directory "/tmp/x/y1/b" has been created

mkdir: The directory "/tmp/x/y2" has been created

[Email protected] tmp]#

[[Email protected] tmp]# tree x//directory structure for viewing directory X

X

|--Y1

| |--A

| '--B

'--y2


Extension 2: Creating A_c,a_d,b_c,b_d

    • [[email protected] tmp]# mkdir./x/{a,b}_{c,d}//polynomial multiplication.

    • [[email protected] tmp]# Mkdir-pv/tmp/x/{a_{c,d},b_{c,d}}

Extension 3:

2, RmDir: Delete directory: (only to delete empty directory, and there is no option to force deletion)

rmdir [OPTION] ... DIRECTORY ...

OPTION

-P: When a directory is deleted, it is deleted if its parent directory is empty.

-V: Show removal process


Linux Directory Operations Command

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.