Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
goat
POSIX-compliant shell movement boosting hack for real ninjas (aka `cd x` and `cd ...`) (by 0mp)
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
fasd
Discontinued Command-line productivity booster, offers quick access to files and directories, inspired by autojump, z and v.
-
hstr
bash and zsh shell history suggest box - easily view, navigate, search and manage your command history.
-
ohmyzsh
🙃 A delightful community-driven (with 2,300+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
In my opinion this replaces (and even does a better job i.e. less typing in the end, less commands to remember) almost everything in the article, especially when combined with https://github.com/rupa/z/. (or the PS counterpart ZLocation). Might be the type of work of course, but ever since I started using this I can go by weeks without needing to manually type cd. After all most of my time is spent in the same directories anyway. And if not, I'm really not manually going to type it, not even tab it, if it can be fuzzy matched since that is nearly always faster. tldr; people do yourself a favor and stop cd'ing around.
I use `autojump`, which sounds quite similar as it also uses your most frequently visited directories.
For exploring massive file trees, a terminal file manager that allows you to preview the contents of subdirectories without entering them is huge time saver. I use `lf`.
https://github.com/wting/autojump
https://github.com/gokcehan/lf
Autojump is great. Another similar one with less functionality but a stripped down script is "bashmarks":
https://github.com/huyng/bashmarks
I use `autojump`, which sounds quite similar as it also uses your most frequently visited directories.
For exploring massive file trees, a terminal file manager that allows you to preview the contents of subdirectories without entering them is huge time saver. I use `lf`.
https://github.com/wting/autojump
https://github.com/gokcehan/lf
~/a$
It changes directory to the last directory you were in (cd keeps track of the last directory in the OLDPWD environment variable).
https://github.com/junegunn/fzf also has a “cd mode”, by default triggerable using Alt-C, which can be useful.
I use (and develop) `goat`. It's like a shortcut manager for aliases for directories you go to often. And a way to make "cd ...." work for any number of dots.
https://github.com/0mp/goat
I exhort you all to take a look at Fasd:
https://github.com/clvv/fasd
Here's my answer to that, an 'nd' (newdir?) alias that calls this python script:
https://github.com/danwills/shell-scripts/blob/bb989985d270c...
This makes all directories with names provided by args, including spaces and multiple levels (slashes) at once. It then enters the resulting directory as well (when aliased including 'cd' as advised in the comment).
I have a few functions in my bashrc for fast directory navigation.
up <#> - cd .. # times
upto
- find dir in the current path above you and cd to itdown
- find dir in the current tree below you including inside any number of subdirectories and cd to ithttps://github.com/robmccoll/dotfiles/blob/master/bashrc#L15...
(Full disclosure This is zsh and I don't have a bash equivalent for that)
Another thing I can't live without and some people hate is ls -la anytime I cd in to a directory. In a gui, I get that visual feedback immediately and it's usually the first thing I type when I land anyway so I just have a function for it https://github.com/gpspake/dotfiles/blob/master/zsh/gpspake/...
I use zoxide: https://github.com/ajeetdsouza/zoxide
There're only few directories I need to change to daily. So when I have to visit them, I need to type only `z first_two_characters_of_the_directory_name`
No mentions of https://github.com/jarun/nnn yet?
Using an actual file manager that has a ton of features without any bloat is in my opinion superior to any bolted on aliases or smart bash scripts.
And if you want to make bash history usable, use hstr [1].
[1] https://github.com/dvorka/hstr
I do the following [1]:
- I define "cdn" to be what others call "mkcd", as then if I have a command line "cd foo" and it tells me that foo doesn't exist, I can just add the 'n' to the previous entry. I also overload "cdn" so that when not given any argument, it goes into the newest subdirectory in the current directory.
- "u", "uu", "uuu", "uuuu", "uuuuu" for going "up" that many levels, and unlike the aliases in OP, I define them as functions and if those are given an argument, they descends into the path from there: "u foo" is equivalent to "cd ../foo", "uu foo" to "cd ../../foo".
- I also have a function called "mvcd foo bar" that moves foo to bar and then goes into bar. "mvcdnewdir foo bar" that does the same but will create bar. (I'm pondering unifying them to a version that always calls mkdir -p)
- an alias "c" for cd [2]. The single letter messes with the history search though (ctl-r c space or ctl-r cd space ?), so it's not necessarily a good idea.
- some functions for special locations, "cs" for ~/scratch, "cb" for ~/bookmarks, etc.
[1] see .bashrc at https://github.com/pflanze/chj-home
We tried to somewhat mimic the finder experience when implementing directory navigation at Fig (https://withfig.com). Except of course, we make it all keyboard driven!
The methods listed in the article are almost certainly better if you know exactly which directory you need to go to (like a specific project repo, your bin etc) however often you don’t!
Another interesting tool is Z: https://github.com/rupa/z
If you frequently need to switch to and from several git branches, pushb and popb are useful commands.
https://github.com/pwoolcoc/pushb