Re:The Linux Commands HandBook
by 29athrowaway on Thursday November 05, 2020 @03:06AM
(#24996462)
pushd and popd. Thank me later.
[ Parent
| on HN ]
Weird, my Ubuntu 20 install does not have man pages on pushd and popd. Are these commands be specific to bash?
Anyway, since we are on the topic of directory navigation, I'd like to introduce 'cd -' (toggle to previous dir). Thank me later :-)
Re:The Linux Commands HandBook
by c2xlZXB5Cg on Thursday November 05, 2020 @09:25AM
(#24998472)
https://www.youtube.com/watch?v=BJ0uHhBkzOQ
First example:
type -a <something>
to discover what <something> is (or if it exists on your system)They are shell-specific, yes. Fish also has it built-in.
Try man -a {pushd,popd} you can also use the man -k flag to find manpages, and see man man (or man --help) for more flags.
zsh also has them.
Another neat way of wrapping code in pushd/popd is to use a subshell.
(cd $dir
do-stuff
)
Oilshell ( https://www.oilshell.org/ ) has support for code blocks so you can: cd /tmp {
do-stuff
}They are bash built-ins. They are documented in bash's man page.
can also use `help pushd` to get manual only for that command ('help' is like 'man' for built-ins)
This is what I needed. None of the man pages showed information on the bash functions. 'help' did the job.
Ironically, 'man help' yields no results.
That's because `help` is also builtin. It's listed under "SHELL BUILTIN COMMANDS" in `man bash 1` (or use the non-obvious `help help`)
Get docs for shell builtins with help. Eg: `help pushd`