How to navigate directories faster with Bash (2015)
mhoffman.github.io
How to navigate directories faster with Bash (2015)
1–10 of 179 posts
Re: How to navigate directories faster with Bash (2015)
#2 Another neat short hand is !$ which is an alias for the last argument of the previous command. This can be handy if one creates a new directory and wants to change into it without typing the the directory again. So commands would be
mkdir -p make/new/directory
cd !$
You've no idea how many years I've been thinking "This is Linux fer gawd's sake. Surely there must be some easy way to make a new directory and 'cd' to it in a single command!" But was never able to find or guess the right incantation.Re: How to navigate directories faster with Bash (2015)
#3Re: How to navigate directories faster with Bash (2015)
#4I upvoted for this alone: Another neat short hand is !$ which is an alias for the last argument of the previous command. This can be handy if one creates a new directory and wants to change into it without typing the the directory again. So commands would be mkdir -p make/new/directory cd !$ You've no idea how many years I've been thinking "This is Linux fer gawd's sake. Surely there must be some easy way to make a n…
Re: How to navigate directories faster with Bash (2015)
#5Re: How to navigate directories faster with Bash (2015)
#6Note that many of these are not just for Bash. pushd/popd is near universal among shells and CDPATH is standard among SYSV shells.
The idea of a shortcut for cd .. and its repetitions is good, but I'd prefer alias p='cd ..', pp='cd ../..' and so on, since I balk at the idea of having to distinguish, e.g., ..... and ...., but I find pppp and ppp are easier to discriminate by eyeball.
The shells I use most often are bash and the Emacs eshell, and over the years I appreciate eshell more and more. It has a few footguns, but the availability of the various selection-narrowing libraries, dired and tramp are huge pluses. zsh can pretty much do anything bash can do and more, and it's default on Macos and Arch Linux.
Re: How to navigate directories faster with Bash (2015)
#7I upvoted for this alone: Another neat short hand is !$ which is an alias for the last argument of the previous command. This can be handy if one creates a new directory and wants to change into it without typing the the directory again. So commands would be mkdir -p make/new/directory cd !$ You've no idea how many years I've been thinking "This is Linux fer gawd's sake. Surely there must be some easy way to make a n…
Re: How to navigate directories faster with Bash (2015)
#8I upvoted for this alone: Another neat short hand is !$ which is an alias for the last argument of the previous command. This can be handy if one creates a new directory and wants to change into it without typing the the directory again. So commands would be mkdir -p make/new/directory cd !$ You've no idea how many years I've been thinking "This is Linux fer gawd's sake. Surely there must be some easy way to make a n…
Typing Esc then . does the trick too.
Re: How to navigate directories faster with Bash (2015)
#9I upvoted for this alone: Another neat short hand is !$ which is an alias for the last argument of the previous command. This can be handy if one creates a new directory and wants to change into it without typing the the directory again. So commands would be mkdir -p make/new/directory cd !$ You've no idea how many years I've been thinking "This is Linux fer gawd's sake. Surely there must be some easy way to make a n…
Re: How to navigate directories faster with Bash (2015)
#10Good selection of tips, like Normille I didn't know $! even though I have read Bash's man page through more than once. Note that many of these are not just for Bash. pushd/popd is near universal among shells and CDPATH is standard among SYSV shells. The idea of a shortcut for cd .. and its repetitions is good, but I'd prefer alias p='cd ..', pp='cd ../..' and so on, since I balk at the idea of having to distinguish,…