The dirs command, combined with pushd and popd, is very effective for tracking users' directory changes. Suppose you have to make some changes to the files present in the following directories:
Instead of noting down the directories on paper, do the following:
$ pushd /home/sangeeth/soft/release2/src/ $ pushd /home/sangeeth/soft/release2/src/show/ $ pushd /home/sangeeth/soft/release2/doc/
To list all the directories, do the following:
$ dirs -l -p -d
Suppose you make all the required changes in the first directory (/home/sangeeth/soft/release2/src/). To remove that directory entry from the list of directories that you created earlier, do the following:
The above command removes the topmost directory entry (/home/sangeeth/soft/release2/src/) and performs a cd to the new top directory, which in my case, will be the second directory (/home/sangeeth/soft/release2/src/show/).
Alternatively, one can pop a particular directory from the list of directories by giving the directory ID (the ID is displayed beside a directory when using dirs -l -p -d) to the popd command:
$ popd +1
More options available for using the above commands can be found by viewing the man pages.
- Reply to comment | Linux Journal
3 hours 47 min ago
18 hours 14 min ago
- Why choose a Flash based product?
18 hours 51 min ago
1 day 7 hours ago
1 day 23 hours ago
- Thanks for clearing that up.
2 days 4 hours ago
- Nice coding on the cake. I
2 days 16 hours ago
- Baker's identity
2 days 21 hours ago
- Uber jealous
3 days 2 hours ago
- Reality is disapointing
3 days 12 hours ago