Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8842849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:04:10+00:00 2026-06-14T11:04:10+00:00

Isn’t there a more intuitive way of dealing with the directory stack than what

  • 0

Isn’t there a more intuitive way of dealing with the directory stack than what is possible with pushd and popd?

I find the CLIs of the pushd and popd built-in commands presented to the user kind of mind-boggling. But at the same time I would love to make frequent use of the directory stack presented by the dirs built-in command.

So it took me quite a long time to figure out use cases and then to memorize the following ones:

  1. pushd – toggle the two directories from the top.
  2. pushd +1 – change to the second from top directory.
  3. pushd -0 – change to the bottom from top directory.
  4. popd +0 – pop the top changing to the second from top directory.
  5. pushd -0; popd +1 – change to the bottom from top directory and pop the former top.

Still having to type them each time just to juggle with the directory stack feels way to heavy to me. I even can’t come up with mnemonic names to alias those five use cases.

Any insights?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:04:11+00:00Added an answer on June 14, 2026 at 11:04 am

    Recently I discovered the power of GNUs readline library and the short cuts in terms of key strokes it can provide to the user on Bash’s command line.

    I therefore defined the following hot keys in my ~/.inputrc file. GNU readline’s configuration file:

    # "pushd" use case.
    "\C-^": "\C-a\C-kpushd\C-m"
    
    # "pushd +1" use case.
    "\e<": "\C-a\C-kpushd +1\C-m"
    
    # "popd +0" use case.
    "\ex\e<": "\C-a\C-kpopd +0\C-m"
    
    # "pushd -0" use case.
    "\e>": "\C-a\C-kpushd -0\C-m"
    
    # "pushd -0; popd +1" use case.
    "\ex\e>": "\C-a\C-kpushd -0; popd +1\C-m"
    

    I associate the hot keys from above as follows:

    1. <ctrl>-^ – vim hot key to toggle the current with the previous buffer.
    2. <alt>-< – Shift left and carry.
    3. <alt>-x< – Shift left and crop.
    4. <alt>-> – shift right and carry.
    5. <alt>-x> – shift right and crop.

    The <ctrl>-ak key strokes position the cursor at the beginning of the line (a) and delete (k) it. This is important because when <ctrl-m> (enter) is hit chances are that the user hit the hot key while in the middle of a sentence. The hot key value would get garbled with the current user input and bash couldn’t execute it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Isn't there any way to find the class-type of a generic? if (T instanceof
Isn't there another way of using global variables in a Java stlye manner in
Isn't there a CSS way of having the page to get a border around
Isn't there some way to re-write the following code, such that I don't need
Isn't there a better way to accomplish this?: (RegionID is a Flex ComboBox) RegionID.selectedItem=value.Region;
Isn't there a better looking statement (or way) to keep the console from disappearing
Isn't there an easy way to select the source files and build them with
Isn't there a way where I can refresh the page right after a database
Isn't there some way to combine two images together using the xOr operator? I
Isn't there a Design Pattern who describes how to high cohesion? I need some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.