Skip to content
Related Articles
Get the best out of our app
Open App

Related Articles

dirs command in Linux with examples

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

dirs command shell builtin is used to display the list of currently remembered directories. By default, it includes the directory you are currently in. A directory can get into the list via pushd command followed by the dir name and can be removed via popd command.


dirs [-clpv] [+N] [-N]

It is useful for easy and quick flow through the directories on the command line. Suppose you want to go to a directory, you can just use the command pushd dir-name and you will be redirected to that directory. Also, you can simply come back to previous by using command popd


  • c : Clears whole list of remembered directories.
  • l : Do not show the path of your home directory in your path-name of a directory.


    /home/vivek/Rocket -> ~/Rocket
  • p : Display one entry per line.
  • v : Display one entry per line prefixed with positional index starting with 0.


  • +N : Displays Nth entry from left.
  • -N : Displays Nth entry from right.


  • Basic Functioning:

  • pushd and popd:

  • Using Options:

  • Using Parameters:

My Personal Notes arrow_drop_up
Last Updated : 15 May, 2019
Like Article
Save Article
Similar Reads
Related Tutorials