pushd (built-in Bash command)

Content

 

Data

License: GNU GPLv3 +
Version number: GNU Bash 5
Developer / owner: Free Software Foundation Inc.

Short description:

The manual page and help for the pushd built-in Bash command. The pushd command adds a directory to the directory stack. It puts a directory on top of the directory stack or rotates the stack, making the current working directory the new top item. Called without arguments, swaps the top two directories and returns 0 unless the directory stack is empty.

The directory stack is a say can be displayed with the command, and popd command to extract a directory from it. The current directory is always the first directory in the stack.

 

 

Man page output

man bash
[...]
       pushd [-n] [+n] [-n]
       pushd [-n] [dir]
              Adds a directory to the top of the directory stack, or rotates  the  stack,  making
              the  new  top of the stack the current working directory.  With no arguments, pushd
              exchanges the top two directories and returns 0,  unless  the  directory  stack  is
              empty.  Arguments, if supplied, have the following meanings:
              -n     Suppresses  the  normal change of directory when rotating or adding directo-
                     ries to the stack, so that only the stack is manipulated.
              +n     Rotates the stack so that the nth directory (counting from the left  of  the
                     list shown by dirs, starting with zero) is at the top.
              -n     Rotates  the stack so that the nth directory (counting from the right of the
                     list shown by dirs, starting with zero) is at the top.
              dir    Adds dir to the directory stack at the top, making it the new current  work-
                     ing directory as if it had been supplied as the argument to the cd builtin.

              If the pushd command is successful, a dirs is performed as well.  If the first form
              is used, pushd returns 0 unless the cd to dir fails.  With the second  form,  pushd
              returns  0 unless the directory stack is empty, a non-existent directory stack ele-
              ment is specified, or the directory change to the specified new  current  directory
              fails.
[...]

 

 

Help output

pushd --help
pushd: pushd [-n] [+N | -N | ktár]
    Könyvtárak verembe tétele.
   
    Egy könyvtárat tesz a könyvtárverem tetejére, vagy forgatja a vermet,
    az új felső elemmé a jelenlegi munkakönyvtárat téve. Argumentumok
    nélkül hívva a két felső könyvtárat cseréli meg.
    
    Kapcsolók:
      -n        Ne váltson könyvtárat hozzáadáskor, vagyis csak a
                vermet változtassa.
    
    Argumentumok:
      +N        Úgy forgatja a vermet, hogy az N-edik könyvtár (0-tól
                kezdve, a „dirs” által kiírt listán balról számolva)
                kerüljön a verem tetejére.
    
      -N        Úgy forgatja a vermet, hogy az N-edik könyvtár (0-tól
                kezdve, a „dirs” által kiírt listán jobbról számolva)
                kerüljön a verem tetejére.
    
      ktár      A verem tetejére helyezi KTÁR könyvtárat, és ugyanezt
                állítja be új munkakönyvtárnak.
    
    A „dirs” beépített parancs listázza a könyvtárvermet.
    
    Kilépési kód:
    Sikerrel tér vissza, kivéve érvénytelen argumentum vagy könyvtárváltás
    során történő hiba esetén.

 

Related Content