Linux directory stack and directory switching

Source: Internet
Author: User

Use CD-(middle bar) to switch to the previous directory

The CD command will change the directory stack

1, dirs

1) function
Displays all records in the current directory stack (the dirs command with no parameters displays the records in the current directory stack)

2) syntax
(1) Format: dirs [-CLPV] [+n] [-n]
(2) Options
-C Delete all records in the directory stack
-l display in full format
-p a directory row of the way display
-V each row is a directory to display the contents of the directory stack, plus the number in front of each directory
+N Displays the nth directory from left to right, with numbers starting from 0
-N Displays the nth Daily record from right to left, with numbers starting from 0
Note: dirs always displays the directory of course, and then the contents of the stack, even if the directory stack is empty, the dirs command still displays only the course directory

2, pushd

1) function
The pushd command is often used to add directories to the stack, add records to the top of the directory stack, and switch to the directory, and if the pushd command does not add any parameters, the 2 directories on the top of the record stack will be swapped for location

2) syntax
(1) Format: pushd [Directory |-n | +n] [-n]
(2) Options
The directory joins the directory to the top of the stack and executes the "CD directory" to switch to that directory
+n move the nth directory to the top of the stack (number starting from the left, number starting from 0, adjusting the stack will change the current directory at the same time)
-N Moves the nth directory to the top of the stack (starting from the right, the number starts at 0, and the adjustment stack changes the current directory at the same time)
-N does not switch directories when the directory is in the stack

3, POPD

1) function
POPD is used to delete records from the directory stack, and if the popd command does not add any parameters, the topmost record of the directory stack is deleted and then the topmost directory in the deleted directory stack is switched to

2) syntax
(1) Format: popd [-n | +n] [-n]
(2) Options
+n Delete the nth directory (from the left, the number starts at 0, and the adjustment stack changes the current directory at the same time)
-N Deletes the nth directory (from the right, the number starts at 0, and the adjustment stack changes the current directory at the same time)
-N does not switch directories when the directory is out of the stack

Linux directory stack and directory switching

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.