Results 1 to 8 of 8

Thread: pushd and popd

  1. #1
    Join Date
    Jan 2012
    Beans
    161

    pushd and popd

    http://paste.linuxassist.net/216055

    Can someone give me the quick rundown on how this works?

  2. #2
    Join Date
    May 2007
    Location
    Leeds, UK
    Beans
    1,675
    Distro
    Ubuntu

    Re: pushd and popd

    It's quite simple; pushd is like cd but it remembers where you were. popd takes you back.

    So if you are in your home directory, you can "pushd Documents" and you will be in your ~/Documents directory. "popd" takes you back to your home directory. As you push and pop, the commands show you the directory you are in and the trail of directories you can go back to:

    Code:
    $ pushd Documents
    ~/Documents ~
    $ popd
    ~
    The reason you can't find a manual page is that it's a bash built-in command. You can find details using:

    Code:
    $ man bash
    ... or here: https://www.gnu.org/software/bash/ma...Stack-Builtins
    Please create new threads for new questions.
    Please wrap code in code tags using the '#' button or enter it in your post like this: [code]...[/code].

  3. #3
    Join Date
    May 2007
    Location
    Leeds, UK
    Beans
    1,675
    Distro
    Ubuntu

    Re: pushd and popd

    There are several ways, but the way I'd do it is to make a new .desktop file that will appear as an entry in the standard menu:

    You mentioned leafpad, so I assume this is Lubuntu?

    Code:
    $ mkdir -p ~/.local/share/applications
    $ cd ~/.local/share/applications
    $ cp /usr/share/applications/lxterminal.desktop ./
    Edit ~/.local/share/applications/lxterminal.desktop and append "--working-directory="/home/kevin/Documents" to the "Exec" line (which is near the bottom). This will make the LXTerminal entry in the "Start" menu open a terminal with the working directory set to your documents directory (assuming your username is "kevin" -- adjust accordingly).

    If you have a shortcut in the panel, you'll need to remove this and re-add the replacement shortcut from the Accessories menu.
    Please create new threads for new questions.
    Please wrap code in code tags using the '#' button or enter it in your post like this: [code]...[/code].

  4. #4
    Join Date
    May 2007
    Location
    Leeds, UK
    Beans
    1,675
    Distro
    Ubuntu

    Re: pushd and popd

    I'm not sure. I tried it in a VM and Ctrl-Alt-T didn't do anything. If it doesn't work, just delete that file from ~/.local.share/applications and add this line to the bottom of ~/.bashrc

    Code:
    cd Documents
    That will apply to all shells, not just those started from menu/panel shortcuts.
    Please create new threads for new questions.
    Please wrap code in code tags using the '#' button or enter it in your post like this: [code]...[/code].

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •