Linux shell pushd popd dirs Command

Source: Internet
Author: User

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 from the left, number starting from 0)
-N Moves the nth directory to the top of the stack (number from the right, number starting from 0)
-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 Nth directories (number from left, number starting from 0)
-N Deletes the nth directory (starting from the right, the number starts with 0)
-N does not switch directories when the directory is out of the stack

Reference: Http://hi.baidu.com/linuxtrip/item/47a38c8eec00e98f4414cfb7

Related Article

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.