Directory management class commands for Linux commands: mkdir, rmdir, tree, DirName, basename

Source: Internet
Author: User

Directory management class commands for Linux commands: mkdir, rmdir, tree, DirName, basename


mkdir command: Create a new directory

Syntax: mkdir [OPTION]/path/to/somewhere

Common parameter options:

-P: Create parent Directory

-V: Show creation process

Example:

How to create a directory under/tmp/: X_m, X_n, Y_m, Y_n

# mkdir/tmp/{x_,y_}{m,n}


rmdir command: Delete directory

Syntax: Rmdir/path/to/somewhere

Common parameter options:

-P: Delete along with empty directory on upper level (use cautiously)


Tree command: List contents of a table

Syntax: Tree [OPTION] ... [DIR]

-D: File of only hierarchical directory type;

-L Level: shows only a few levels;


dirname command: Removes the file name (part of the non-directory) from the given file name that contains the absolute path, and then returns the remaining


Path (part of the directory)

Syntax: DirName FILENAME

Example:

# Dirname/etc/sysconfig/network-scripts/ifcfg-eth0

/etc/sysconfig/network-scripts


basename command: Removes the left part of the directory from a given file name that contains an absolute path, or simultaneously removes a suffix within


(Part of the directory), and then return to the remainder (part of the non-directory)

Syntax: basename FILENAME [SUFFIX]

Example:

#basename/etc/sysconfig/network-scripts/ifcfg-eth0

Ifcfg-eth0


This article is from the "10,000-hour Law" blog, be sure to keep this source http://daisywei.blog.51cto.com/7837970/1687820

Directory management class commands for Linux commands: mkdir, rmdir, tree, DirName, basename

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.