Linux Directory Management commands

Source: Internet
Author: User
Tags aliases create directory

1. Open Folder command: CD

Cd/dir

Example: Opening the ETC directory

cd/etc/

2. View current directory command: PWD

Example: Current Location/tmp

tmp]# pwd
/tmp


3. View all files and folders under current path: LS

Example: currently under the/etc/sysconfig/network-sprits directory

network-scripts]# ls
Ifcfg-eth0 ifdown-isdn ifup-aliases Ifup-plusb Init.ipv6-global
Ifcfg-lo ifdown-post IFUP-BNEP ifup-post net.hotplug
Ifdown ifdown-ppp Ifup-eth ifup-ppp network-functions
IFDOWN-BNEP ifdown-routes ifup-ippp ifup-routes Network-functions-ipv6
Ifdown-eth ifdown-sit Ifup-ipv6 Ifup-sit
IFDOWN-IPPP Ifdown-tunnel ifup-isdn Ifup-tunnel
Ifdown-ipv6 ifup Ifup-plip ifup-wireless

Using the parameter al: Displays all files, folders and related properties under the current path

Ls-al
Total Dosage 212
Drwxr-xr-x. 2 root root 4096 March 9 22:20.
Drwxr-xr-x. 7 root root 4096 March 24 07:41..
-rw-r--r--. 1 root root 205 March 9 22:20 ifcfg-eth0
-rw-r--r--. 1 root root 254 July Ifcfg-lo
lrwxrwxrwx. 1 root root 20 March 9 22:10 Ifdown. /.. /.. /sbin/ifdown
-rwxr-xr-x. 1 root root 627 July IFDOWN-BNEP
-rwxr-xr-x. 1 root root 5511 July Ifdown-eth
-rwxr-xr-x. 1 root root 781 July ifdown-ippp
-rwxr-xr-x. 1 root root 4168 July Ifdown-ipv6
lrwxrwxrwx. 1 root root 11 March 9 22:10 ifdown-isdn-IFDOWN-IPPP
-rwxr-xr-x. 1 root root 1481 July ifdown-post
-rwxr-xr-x. 1 root root 1064 July ifdown-ppp
-rwxr-xr-x. 1 root root 835 July ifdown-routes
-rwxr-xr-x. 1 root root 1465 July ifdown-sit
-rwxr-xr-x. 1 root root 1434 July Ifdown-tunnel
lrwxrwxrwx. 1 root root 18 March 9 22:10 ifup. /.. /.. /sbin/ifup
-rwxr-xr-x. 1 root root 12532 July ifup-aliases
-rwxr-xr-x. 1 root root 859 July IFUP-BNEP
-rwxr-xr-x. 1 root root 10913 July Ifup-eth
-rwxr-xr-x. 1 root root 11971 July ifup-ippp
-rwxr-xr-x. 1 root root 10490 July Ifup-ipv6
lrwxrwxrwx. 1 root root 9 March 9 22:10 ifup-isdn-IFUP-IPPP
-rwxr-xr-x. 1 root root 727 July ifup-plip
-rwxr-xr-x. 1 root root 954 July Ifup-plusb
-rwxr-xr-x. 1 root root 2364 July ifup-post
-rwxr-xr-x. 1 root root 4154 July ifup-ppp
-rwxr-xr-x. 1 root root 1925 July ifup-routes
-rwxr-xr-x. 1 root root 3289 July ifup-sit
-rwxr-xr-x. 1 root root 2563 July Ifup-tunnel
-rwxr-xr-x. 1 root root 3951 July ifup-wireless
-rwxr-xr-x. 1 root root 4623 July Init.ipv6-global
-rwxr-xr-x. 1 root root 1219 July Net.hotplug
-rw-r--r--. 1 root root 14426 July network-functions
-rw-r--r--. 1 root root 29853 July Network-functions-ipv6

4. Create Folder command: mkdir

Example: mkdir test

Create test directory under current directory;

Parameter:-p, does not error when present, and can automatically create the required directories

If you specify that the test directory be created under the tmp/haole/directory, the-p command forces the Create Haole/test command

Example:

Mkdir-p/tmp/haole/test

Parameter-V, which displays the details of the creation

Parameter:-M MODE, specifying Create directory permission


5, delete directory command, rmdir;rmdir command only delete empty folder

Example: Deleting a/tmp/hsole/test directory


RmDir test

6. Display the directory structure in a tree-like chart

├──custom-background.php
├──custom-header.php
├──customize.php
├──edit-comments.php
├──edit-form-advanced.php
├──edit-form-comment.php
├──edit-link-form.php
├──edit.php
├──edit-tag-form.php
├──edit-tags.php
├──export.php
├──freedoms.php
├──images
│├──align-center-2x.png
│├──align-center.png
│├──align-left-2x.png
│├──align-left.png
│├──align-none-2x.png
│├──align-none.png
│├──align-right-2x.png
│├──align-right.png
│├──arrows-2x.png
│├──arrows.png
│├──browser.png
│├──browser-rtl.png
│├──bubble_bg-2x.gif
│├──bubble_bg.gif
│├──comment-grey-bubble-2x.png
│├──comment-grey-bubble.png
│├──date-button-2x.gif
│├──date-button.gif
│├──generic.png
│├──icons32-2x.png
│├──icons32.png
│├──icons32-vs-2x.png
│├──icons32-vs.png
│├──imgedit-icons-2x.png
│├──imgedit-icons.png
│├──list-2x.png
│├──list.png
│├──loading.gif
│├──marker.png
│├──mask.png
│├──media-button-2x.png
│├──media-button-image.gif
│├──media-button-music.gif
│├──media-button-other.gif
│├──media-button.png
│├──media-button-video.gif
│├──menu-2x.png
│├──menu.png
│├──menu-vs-2x.png
│├──menu-vs.png
│├──no.png

Parameters:

-D: Show only directories

-L Level: Specifies the number of levels of the directory

-P Pattern: Displays only the paths that are matched by the specified pattern


Linux Directory Management 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.