17 ms·
Zsh Tricks to Blow Your Mind
- photoGrant 6y agoTake, alone, is an amazing unknown to me.
- ngngngng 6y agohttps://github.com/natethinks/jog/ https://github.com/natethinks/jog/ I'm not sure why this isn't a part of zsh already, but if you want to see the last few commands you ran in the current directory, that little utility will do that for you. Great for reminding yourself what you did last time you were in a directory.
- aarchi 6y agoWow jog is tiny: grep -a "${PWD} " ~/.zsh_history_ext | cat | cut -f1 -d"|" | tail
- axaxs 6y agoWhy does it pipe to cat?
- viraptor 6y agoMaybe instead of `grep --color=never`? (i.e. to force non-terminal behaviour) Then again, cut would do the same thing anyway.
- ngngngng 6y agoWhen I was exploring projects that did this I found an alternative that spun up a database and was literally thousands of lines of code. This seemed to fit exactly what I was looking for without insane levels of overhead.
- oweiler 6y agomcfly is a nice alternative https://github.com/cantino/mcfly https://github.com/cantino/mcfly
- deleted 6y ago[deleted]
- ruined 6y agodid twilio suddenly become medium? why are they posting zsh tricks blogspam
- Raed667 6y agoThey always had "developer tips" even on their YouTube
- yuchi 6y agoThis is called Inbound Marketing, which consists of creating actual useful content slightly tangential to your own product/service so to attract audience which will, potentially, convert to customers. Sometimes it’s well executed (see Realm’s) sometimes it’s not.
- alexmingoia 6y agoIf you’re on 10.15 (Catalina) there’s no need to install zsh, it is the default shell. If you’ve upgraded and are still using bash, just do ‘chsh -s /bin/zsh’ to set the default to zsh.
- hsbauauvhabzb 6y agoIs this OS X? Is zsh the default there?
- pvinis 6y agoYes
- dtjohnnyb 6y agoWhat was the reason for them doing this do you know? From my experience with it over the last year, zsh is slightly worse at autocomplete than bash, with no advantages. Is there something I'm missing, like a good default .zshrc?
- semiquaver 6y agoBash licensing (GPL)
- bombcar 6y agoTo be precise - Apple was stuck on the last GPL 2 version of bash and finally gave up and moved to zsh which doesn’t have the GPL 3 license but is bash compatible and they can keep it updated. Apple really doesn’t like GPL 3.
- janhenr 6y agoCheck out ohmyzsh for a great ~/.zshrc
- dtjohnnyb 6y agoAwesome, that's pretty amazing, thanks a mill!
- perlpimp 6y agowould like to chime in a faster theme written in rust: https://starship.rs/ https://starship.rs/
- eurg 6y agoLast time I checked it was slower than https://github.com/romkatv/powerlevel10k https://github.com/romkatv/powerlevel10k, because it doesn't decouple the rendering of the prompt from the background processes collecting status information. Ergo no instant prompt. Also, some other cool tricks w.r.t. prompt vs. backscroll. Has that changed?
- deleted 6y ago[deleted]
- antihero 6y agoIt seems fast enough but once you enter an actual directory of code where it needs to get the version of node, kotlin, package, etc it slows down noticeably. I've ended up disabling most packages because it is absurd to (I assume) be running node --version every time a prompt is generated. It's a shame they can't do these things asyncronously or cache them.
- eurg 6y agoCaching is a bit dangerous, and most shells don't support asynchronous prompt updates. And cross-shell support seems to be a prime feature. Spending probably a lot of effort just for improving zsh experience might just not have been important enough yet.
- antihero 6y agoYeah, it is tricky. Perhaps if the prompt was generated async? Turns out my main issue was due to having a slow node --version command due to using asdf! This project was a huge help: https://github.com/danhper/asdf-exec https://github.com/danhper/asdf-exec
- 6y ago
- zer0kool 6y agoWhy is no one talking about that terrible font! It's def not monospaced from the looks of it!
- trangon 6y agozsh4humans is the most recent zsh “trick” I’ve discovered. zsh is a bit like emacs when first installed: it can do a lot of things but it’s not nearly as useful without a lot of manual configuration. I’m honestly surprised it doesn’t have more stars on GitHub. https://github.com/romkatv/zsh4humans https://github.com/romkatv/zsh4humans
- fluential 6y agoI like very much https://github.com/sorin-ionescu/prezto https://github.com/sorin-ionescu/prezto
- Fogest 6y agoIs this similar to Oh My Zsh [1]? I personally have been using Oh My Zsh for years and I've always been a fan of it. I can quickly add themes and plugins and have my shell ready to go how I like it quite quickly on new systems. [1]: https://ohmyz.sh/ https://ohmyz.sh/
- trangon 6y agozsh4humans is like ohmyzsh but much better IMO because when you first install zsh4humans, it walks you through a setup wizard that walks you through choosing your fonts, prompt style, completion style, etc. and automatically installs the appropriate zsh plugins and things like powerline fonts according to your choices.
- Fogest 6y agoOh wow, that actually sounds much nicer! I wonder if it's worth switching to this or if I may as well stay with ohmyzsh for now and switch to zsh4humans in future installs.
- j-james 6y agoA lot of these can be easily done in Bash, too! 1. `mkcdir () { mkdir -- "$1" && cd -- "$1"; }` 2a. `bind '"\e[A":history-search-backward'; bind '"\e[B":history-search-forward'` 2b. Default behavior for Bash. 3. `shopt -s autocd` 4. `mmv`, `perl-rename` 5. `qalc` from libqalculate: https://github.com/Qalculate/libqalculate https://github.com/Qalculate/libqalculate 8. Default behavior for Bash. 9. Default behavior for Bash.
- rootlocus 6y ago> 5. `qalc` from libqalculate: https://github.com/Qalculate/libqalculate https://github.com/Qalculate/libqalculate Or, you know, any REPL available.
- alpaca128 6y agoOr a simple `=() { bc -l <<< "scale=10;$1" }` in the usual bash file and you can use bc to do calculations by starting with a =. Just a little shortcut but REPLs like Python's take a while to spin up, so it's pretty convenient.
- xorcist 6y agoThat's a nifty idea! Maybe without lower scale and with the semicolon: = () { bc -l <<< "$*"; } "Stealing" the equals sign for this purpose feels a bit risky, but maybe it isn't.
- JNRowe 6y agoI'd guess that xorcist added a space at the end of the function name because zsh uses =( to specify one type of process substitution. Without the space or an escape for = zsh will error on alpaca128's definition believing you wanted something else entirely. To that point zsh has some excellent additions for process substitution beyond bash's <(list), but it also makes for yet more weird incompatibilities for when that matters. I only looked at this to start with because I assumed the space was because =() would have been treated as the full path modifier for a command called (), because it would mean that with any other character including other bracket types. TIL.
- 29athrowaway 6y agoNone of these blew my mind. If you like terminal productivity I recommend: fzf, Facebook path picker (aka fpp), fd, ripgrep, lf, tig. Some honorable mentions: tokei, hyperfine, lazydocker, ctop, ncspot.
- alpaca128 6y agoSolid selection. I'd also add nnn as the fastest tool to navigate directories I've ever seen.
- 29athrowaway 6y agonnn is certainly very fast. lf is also fast but has ranger's look and feel.
- Zizizizz 6y agoHave you been able to get it to cd on quit? it's the only thing I can't seem to get. It's amazing though.
- alpaca128 6y agoPressing `!` in the target directory will open a new terminal session within nnn, with that path as working dir. When you `exit` you'll land in nnn again. It's not exactly the same but close enough for me.
- JNRowe 6y agoHmm, if you mean the C-g behaviour then you need to set $NNN_TMPFILE: nnn() { declare -x +g NNN_TMPFILE=$(mktemp --tmpdir $0.XXXX) trap "rm -f $NNN_TMPFILE" EXIT =nnn $@ [ -s $NNN_TMPFILE ] && source $NNN_TMPFILE } You can use a static file if you're sure you'll never be running more than one instance. I'd prefer something like: nnn() { local tmp=$(mktemp --tmpdir $0.XXXX) trap "rm -f $tmp" EXIT =nnn -p $tmp $@ [ -s $tmp ] && cd ${"$(< $tmp)":h} } That will cd to the selected file's directory with enter/right, or do nothing if you simply quit. I guess it depends if you use it for browsing a lot or simply picking a file.
- aarchi 6y agofish shell has a lot of this built-in.
- xyzal 6y agoRecently fell in love with fish. Sadly, subshell functionality is still absent, so I use it in interactive mode only.
- nathias 6y agosome of them aren't really zsh but plugins
- StreamBright 6y agoI am still trying to figure out if I should stick to fish or switch over to zsh.
- antihero 6y agoIs oh-my-zsh still dog slow? I've been using zgenom and just picking the plugins I want and it's blazing fast.
- krono 6y agoHere's a nice tool for sporadic terminal users like myself: https://github.com/marlonrichert/zsh-autocomplete https://github.com/marlonrichert/zsh-autocomplete It sometimes has some minor issues but a very responsive maintainer. Also integrates pretty well with other tools/scripts.
- Toutouxc 6y agoThe #2 behavior (up-down arrow cycles through usages of command) doesn't work OOTB on macOS's zsh. Is it a new-ish feature or a plugin that I don't have?
- primozk 6y agoYou need oh-my-zsh
- JNRowe 6y ago'bindkey "${key[Up]}" up-line-or-search' is probably the incantation you're looking for if you don't want to use oh-my-zsh or whatever. The $key hashmap is generated by zsh's zkbd so that your config can be terminal independent, but you can insert the actual key if you prefer not to use zkbd or only use one terminal type. There are a bunch of other search types available, zshzle(1) has all the gory details.
- reportgunner 6y agoWorks in bash https://coderwall.com/p/oqtj8w/the-single-most-useful-thing-in-bash https://coderwall.com/p/oqtj8w/the-single-most-useful-thing-...
- gangstead 6y agoMy favorite alias, which is not really a zsh exclusive thing, is combining cd && ls : cl() { cd "$@" && ls; } It's wonderfully simple and saves me so much time by giving me an instant refresher of what's in the directory I just changed to.
- drran 6y agoRun mc, navigate to dir, press ^O to switch back to shell.
- kart23 6y agoDo people... actually use this font in their terminal? I would go absolutely nuts looking at the spacing and color scheme.
- Deukhoofd 6y agoI know comic sans is often used by dyslexic people, as they can read it more easily, so I'd expect it's something similar.
- tgv 6y agoI wouldn't be surprised if this was coerced by the marketing department, trying to imbue that "ooh, look at me, I'm a bit crazy, so creative" vibe for a bloody shopping list.
- enriquto 6y agoI have no comments about this particular font. But if your marketing department has any say in your terminal fonts, you should quit this creepy place as soon as possible!
- tgv 6y agoThat would be almost as unlikely as someone using that horrid colorscheme, but they might have a say about the blog layout and content.
- DyslexicAtheist 6y ago> Do people... actually use this font in their terminal? seems so. recently discussed: https://news.ycombinator.com/item?id=25520510 https://news.ycombinator.com/item?id=25520510 https://dtinth.github.io/comic-mono-font/ https://dtinth.github.io/comic-mono-font/ http://www.comicneue.com/ http://www.comicneue.com/
- kart23 6y agosee, the kerning is fine on that though. its not my taste, but it works. This article looks like either something is just wrong with the font, or letterspace needs to be adjusted in the terminal's config.
- pw6hv 6y agoI just recently ditched oh-my-zsh as I wanted to understand and have more control over my shell. I have to say that just using native zsh capabilities I don't miss oh-my-zsh at all. A good guide (although a bit old and maybe too thick :) ) is this one: http://zsh.sourceforge.net/Guide/zshguide.pdf http://zsh.sourceforge.net/Guide/zshguide.pdf
- JNRowe 6y agoIf you're looking to go full rabbit hole, the zsh native scripting handbook is good for a few examples. Easy to end up in linenoise if you're not careful though. A fair few really nice zsh things in zdharma's GitHub repos too. https://zdharma.org/Zsh-100-Commits-Club/Zsh-Native-Scripting-Handbook.html https://zdharma.org/Zsh-100-Commits-Club/Zsh-Native-Scriptin...
- knorker 6y agoSeveral of these are not just common to all shells, but even work in other tools, like emacs, E.g. ctrl-l and ctrl-r
- qalmakka 6y agoI've been using Fish instead and it's much much simpler than configuring ZSH to my liking. It's already good out of the box, without having to carry around any kind of configuration. The only stuff I usually do is to setup `powerline-go` as prompt, and voilà, that's pretty much it.
- Jasp3r 6y agoThe main drawback for fish is that is not compatible with bash scripting. If you need help with something specific, you can throw out almost all help available online.
- deleted 6y ago[deleted]
- kristopolous 6y agoI've been thinking about a more fluid way to hybridize these different shells. I'd like a way to get all the benefits without the cost or any extra required effort for the user. Some painless master shell program. No epiphanies yet though.
- RealStickman_ 6y agoI just have both installed. Fish for interacting and bash for scripting.
- oblio 6y agoI can never understand this complaint. I'm frequently on Windows and use Cygwin. Do you know what I do? I use zsh. Let's say I need bash. "bash<Enter>". I'm in bash :-) I need cmd (yup, that can happen). "cmd<Enter>". I need to run just one command with bash: "bash command<Enter>". I need to run just one command with cmd: "cmd /c command<Enter>". These problems are trivially solvable :-)
- mattgreenrocks 6y agoSwitched to fish for daily use a year ago and have only had to fallback to bash maybe 3-4 times for a gnarly command invocation that was bash only.
- qalmakka 6y ago... Why are all shell snippets in Comic Sans? Is that legal?
- krono 6y agoI'd also dare to bet the author's favourite pizza is Hawaiian/pineapple
- pnut 6y agoSalty/sweet contrast is the core of Hawaiian pizza appeal, and flavour/texture contrasts are the foundation of some of the most interesting foods, for instance salted caramel, pork and apples, etc.
- hotsauceror 6y agoPineapple, banana pepper, and jalapeño may be my favorite pizza.
- halostatue 6y agoPineapple, mushroom, artichoke, caper.
- krono 6y agoThat makes a lot of sense. Admittedly the only Hawaiian pizza I've ever had came from the freezer. Whenever the local Italian restaurant opens back up I'll go and try a properly made Hawaiian pizza :)
- qalmakka 6y agoPork and pineapple is arguably good; the problem here is the pizza around it, which clashes horribly with pineapple. This is especially true for tomato, which unless very sweet and acidic like in sticky sauce, it doesn't go well at all with pineapple.
- bserfaty 6y ago
- closeparen 6y agoMy company is fond of putting source code under very deep directory structures, so I quite like Z: https://github.com/agkozak/zsh-z https://github.com/agkozak/zsh-z Not ZSH specific, but it's also handy to load project-specific environment variables automatically on entering directories: https://direnv.net/ https://direnv.net/.
- climb_stealth 6y agoI very much agree on z. Also fzf [0]. It is super fast and makes a huge difference when working in code bases with code 12 levels deep. [0] https://github.com/junegunn/fzf https://github.com/junegunn/fzf
- read_if_gay_ 6y agoAlso recommend the fzf vim extension. I use it to navigate my Vimwiki Zettelkasten.
- cfors 6y agoUsing fzf and ctrl+r for fuzzy finding commands is a godsend. Basically all snippets of code that I ever run are straight from this. Forget how to exactly reset a committed local file that you want to place into another commit? Not something I do everyday, so may require some Googling if I can't remember exactly. What I do know, is that I use something with `git reset`. I ctrl+r and type `git reset` and here is what comes up: > 9488 git reset HEAD^ > 10535* git reset --hard > 10555* git reset HEAD file > 10999* git reset --soft HEAD Oh right, I need to reset the commits and then remove that file from the commit and I can recommit. It is a complete gamechanger.
- toastal 6y agoDirenv has made it a lot easier to source Bash-styled environment variable in a fisd shell and has `use nix` built in for using the Nix package manager for projects and getting a shell environment with all of your local project dependencies.
- LordJohn 6y agoIn article is Comic Sans?
- beshrkayali 6y agoPretty clickbaity title. Nothing "mind blowing" about what's in that article really. I used to use Zsh but switched back to bash a few years ago because most of the things I liked in Zsh turned out to be doable in Bash and I just didn't look enough.
- trzeci 6y agoI'm more amazed how that page is unreadable, starting from typography up to color scheme.
- jcelerier 6y agothe kerning in the screenshots is "hilarious"
- blueflow 6y agoThanks for pointing it out. Aaaaaargh
- DyslexicAtheist 6y agolooks like a version of Comic Sans, possibly http://www.comicneue.com/ http://www.comicneue.com/ or as recently discussed Comic Mono: https://news.ycombinator.com/item?id=25520510 https://news.ycombinator.com/item?id=25520510 https://dtinth.github.io/comic-mono-font/ https://dtinth.github.io/comic-mono-font/
- mhd 6y agoThose would be better kerned. This is probably using the default Comic Sans forced to fixed width. Which is predictably bad.
- arcturus17 6y agoI personally don't think the typography in the page itself is bad, it's the screenshots (and indeed their color schemes and types) and the lack of vertical rhythm of the whole thing that pose the biggest problems.
- reportgunner 6y agoWhen I saw comic sans in terminal I knew what's up.
- michaelmcmillan 6y ago> If you've typed or pasted a long command and decide you need to edit it before running, ctrl-x-e opens it in an editor Jeez, this is great!
- mkl 6y agoThis works in bash too. To see all keyboard shortcuts in bash, type "bind -P". There are lots of neat things in there.
- deleted 6y ago[deleted]
- joshlk 6y agoZsh is the default shell on MacOS. It has been since Catalina. Oh-my-zsh supercharges your zsh setup its great https://github.com/ohmyzsh/ohmyzsh https://github.com/ohmyzsh/ohmyzsh.
- bjornorn 6y agooh-my-zsh tricks to blow your mind seems like a more appropriate title. I tried some of them in zsh, and they didn't work, because they assume you also installed oh-my-zsh.
- entropie 6y agoSo this is the HN frontpage now? Thats the same clickbaity title every old blog/news site uses and I try to avoid as good as I can.
- martinp 6y agoSome of these are specific to oh-my-zsh. For example: 1. take command: https://github.com/ohmyzsh/ohmyzsh/blob/8b37f817c29715873b91c8a8e7f883eccc240895/lib/functions.zsh#L16 https://github.com/ohmyzsh/ohmyzsh/blob/8b37f817c29715873b91... 2. History substring search is a separate module: https://github.com/zsh-users/zsh-history-substring-search https://github.com/zsh-users/zsh-history-substring-search, which I assume oh-my-zsh configures
- mitnk 6y agoThere is always a group of people wanting to "hack" terminals into GUI-targeting, glittering app ;)
- Lapsa 6y agoMind not blown.
- alvarlagerlof 6y agoI just got a summer internship offer from these people. How is it there?
- dvfjsdhgfv 6y agoWhat's the problem with everyone abusing hyperboles like that? No, my mind hasn't been blown by teh fact you can create a directory and enter it, and if I care enough I can reimplement this one and all others in Bash too and keep compatibility with all the machines I work on.
- ktm5j 6y agoThe `take` command doesn't seem to have anything to do with vanilla zsh.. I don't have that on my linux system in zsh.
- lomereiter 6y agoIndeed, this comes from oh-my-zsh (lib/functions.zsh)
- mattacular 6y agoBeen using zsh for years and many of these were new to me. I love #3 and use it daily. I find it most helpful to use this trick to type ".." or "..." and quickly navigate back a dir or two. Of course you can do this in bash (and other shells) with aliases, it does not come out of the box like so many niceties in zsh.
- yboris 6y agoI have a favorite alias `u` (stands for "up") to go up a directory. 50% keystroke savings ;)
- cb321 6y agoI have a shell function `.` that goes up one: .() { if [ $# -eq 0 ]; then cd ..; else source $\*; fi; } then alias ..='cd ../..' alias ...='cd ../../..' . . So that "however many periods" goes up however many directory levels. Seems a coherent shorthand to me, though I guess uuuu also works.
- ibraheemdev 6y agoMy favourite is setting "git" as a suffix alias to clone repo urls I copy paste: alias -s git="git clone"
- gbolcer 6y agoI always liked tcsh for how they did for loops. It's taken me 20 years of bash and I still always get the syntax wrong the first time. I need to figure out how to alias it. I like the ^R trick. In bash I usually just !(whatever the string is) which only matches the last one or the more infamous !?(whatever the file/obj you were applying the command to)?
- thenoblesunfish 6y agoPlease, no. Bash (or better, sh) are just fine. They are good enough, and they are standard. I can log in anywhere and do things.
- devilduck 6y agozsh is POSIX compliant and has been around for a very long time. Long enough to be considered a standard. csh too.
- Xophmeister 6y agoMy favourite feature of zsh (it might be oh-my-zsh), is the tab expansion of unambiguous abbreviated paths. Say if you do: $ cd /u/b/l<TAB> That will expand into /usr/bin/local. If there are ambiguities at any point, it will expand as much as it can and let you fix it at the point where a decision needs to be made (pressing tab again will show you the options, like Bash et al). For example: $ /u/b/gr<TAB><TAB> $ /usr/bin/gr grep groff groups
- dhagz 6y agoAs far as I know, that's not oh-my-zsh, since I can do that and I don't have omz installed.
- JNRowe 6y agoYou're right, all it requires is a call to compinit from base zsh: `autoload -Uz compinit; compinit` And compinstall can be used to configure things like the case-sensitivity or amount of ambiguity accepted in matches using a nice menu system.
- weinzierl 6y ago> Ctrl-q "parks" the command What is the zsh functionality behind this? I couldn't test it because my terminal eats Ctrl-q and a search for "zsh ctrl-q" didn't turn up anything useful.
- chris_st 6y agoYes please -- this sounds great, I used to use `ctrl-u` then `ctrl-y` with bash, and that doesn't work with zsh, alas. I tried searching for `zsh "park" command` and got nothing useful.
- mjg123 6y agoIt's a feature of the zsh line editor called "push-line". http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html
- chris_st 6y agoThanks very much! Adding: bindkey '^q' push-line works perfectly. Day improved!
- JNRowe 6y agoYou can also operate on the stack of pending commands programatically using the read and print builtins along with the common to both -z option. It can be a really nice way to build up or edit complex commands/variables in combination with expansion flags and such. 'print -z goodbye; print -z hello' for the five second example of what happens.
- weinzierl 6y agoThank you, I love it. This is so great for a quick ls or cd in between. Turns out it wasn't the terminal that was eating my Ctrl-q, but the key wasn't bound in my zsh. The page you linked says push-line (^Q ESC-Q ESC-q) (unbound)(unbound) Does that mean that in a standard config push-line is bound to Ctrl-q?
- mhd 6y agoKnew most of those, not much interested in "shell plugins". One thing that many people miss are parameter expansions. Those are in Posix, so pretty much any bare shell should be able to use that, too. So dash/bash/zsh/ksh… echo Hello ${PLANET:-World} to have a default if you're not sure a variable is set. Replace "-" with "=" to actually set it, not just use it for this statement. Or removing suffixes: filename=/tmp/foobar.tar.gz echo ${filename%.*} # -> /tmp/foobar.tar echo ${filename%%.*} # -> /tmp/foobar Saves you some useless sed/awk. I still wish the Linux shells (bash/zsh) would start to finally get some more features from friggin' ksh93.
- olsgaarddk 6y agoThat's a really neat way of trimming the file extension, something that can end up being quite tedious to do with SED. Do you know of a cheatsheet that describes what all the percentage sign means and other things you can do with parameter expansions?
- Symbiote 6y agoThe old way to remove a file extension is using basename: basename -s .png example.png example
- mhd 6y agoAlso strips the path and you have to know the extension name(s). For my examples, "cut" would be appropriate. But those substitutions tend to work in anything POSIX, not just bash/zsh.
- Tiksi 6y agoThe bash hackers wiki has a pretty good list of the bash/posix one, tldp does too, but I find it less straight forward. https://wiki.bash-hackers.org/syntax/pe https://wiki.bash-hackers.org/syntax/pe https://tldp.org/LDP/abs/html/parameter-substitution.html https://tldp.org/LDP/abs/html/parameter-substitution.html The zsh docs are good for the zsh specific expansions, but more man page than cheatsheet, though they do have an intro doc on it that's more cheatsheet like but less complete. http://zsh.sourceforge.net/Doc/Release/Expansion.html http://zsh.sourceforge.net/Doc/Release/Expansion.html http://zsh.sourceforge.net/Intro/intro_12.html http://zsh.sourceforge.net/Intro/intro_12.html
- olsgaarddk 6y agoA lot of the tips from TFA can be done in BASH as well and I'm sure the following of my own zsh tips also have a bash equivelant, but I'd like to share anyway: Pure theme - My absolute favorite shell theme. Has almost all the bells and whistles of the powerlevel9k shown in the article, but looks, much cleaner and less in-your-face. After downloading the theme, I've added this to my `.zshrc` file: # PURE theme - see https://github.com/sindresorhus/pure fpath+=$HOME/.zsh/pure autoload -U promptinit; promptinit prompt pure Fuzzy find makes searching history much more powerful than what is listed in the article. I only use it together with ctr-r, but you can set it up for even more goodness. # Fuzzy find - see https://github.com/junegunn/fzf [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh Lastly I've added a syntax highlighter, which is really neat. # ZSH Syntax Highlighter - see https://github.com/zsh-users/zsh-syntax-highlighting source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh I don't use oh-my-zsh, but I think my terminal is as fully fledged as even the best oh-my-zsh can offer.
- yboris 6y ago+1 for the `zsh-autosuggestions`: https://github.com/zsh-users/zsh-autosuggestions https://github.com/zsh-users/zsh-autosuggestions Bonus: `zsh-syntax-highlighting` is excellent: https://github.com/zsh-users/zsh-syntax-highlighting https://github.com/zsh-users/zsh-syntax-highlighting
- tomduncalf 6y agoKnew a few of these, but "7. Park a command" and "8. Easily edit a command after you've typed it on the command line" are great to know!
- squibbles 6y agoApple has kind of herded me into zsh for work in the terminal. So far it has been pleasant, with interesting plugins, but it's periodic updates are a little annoying. Despite remaining in zsh while in a terminal, I still find myself writing only bash scripts when a script it needed.
- swirepe 6y ago>Despite remaining in zsh while in a terminal, I still find myself writing only bash scripts when a script it needed. I do this too. I think it's good practice; zsh is amazing as an interactive shell, but bash is everywhere.
- quesera 6y agoBash is not everywhere, but /bin/sh is..! If portability is important, I'd recommend Bourne shell instead. Sometimes there's a justification for writing shell scripts in bash. E.g. if you only care about Linux forever. Frequently though, a simple script will unexpectedly grow, and start to require non-trivial data structures, etc. If there's no time for a rewrite in a more appropriate language (Python/Ruby/Perl), then moving to bash can be a compromise.
- swirepe 6y ago>if you only care about Linux forever. You caught me, and you're right: sh (not bash) is the portable option.
- itsjustmath 6y agoI can't live without oh my zsh's git aliases: https://github.com/ohmyzsh/ohmyzsh/wiki/Cheatsheet#git https://github.com/ohmyzsh/ohmyzsh/wiki/Cheatsheet#git
- amdolan 6y agoNever use sudo with `npm install` as was done in example 6. I know it's off topic, but it would be good if the author could change that example. In general, one should never use sudo with package managers.
- whalesalad 6y agoFunny, like the author I also have a 'desktop not icloud' folder but I just call it 'scratch' If you opt-in to the iCloud personal folder mirroring feature it will move your Desktop folder into the cloud. This gets kinda troublesome if you are the kind of person who uses your desktop as a scratch space for random crap. I now have a ~/scratch folder for this. I also added a ~/screenshots folder and used the app Onyx to change where macOS saves screenshots. Now I get the best of both worlds.
- t0mbstone 6y agoThis person uses comic sans for their terminal font!?
- devilduck 6y agoThis article is absolutely trolling me with that terminal font.
- m0d0nne11 6y ago<sigh!> The fatuous use of animated images to illustrate the wonders of a tool that is fundamentally text/character based is (ahem!) puzzling, considering that those most likely to be interested are also those most likely to wish they could do simple Cut/Paste of the examples for experimentation, now difficult or impossible because of all the glitz....
- mettamage 6y agozcalc... hmm... My trick is to type: r one letter, boom calculator! (and so much more)
- GuB-42 6y agoI am using zsh and several of these "tricks" don't work. 1- "take" is not a default built-in 2a- that up-arrow is not default behavior 2b- ok, ctrl-r works as expected (works in bash too) 3- automatic cd is not default behavior 4- ok, zmv is a standard module that is explicitly autoloaded in the article 5- zcalc, like zmv, requires loading a standard module, the article doesn't mention that 6- ok, oh-my-zsh has plugins 7- ok, ctrl-q works as expected 8- ctrl-x-e doesn't work for me (but works in bash) 9- ok, ctrl-l works as expected (works in bash too) All these are probably specificities of oh-my-zsh, a very popular module that I don't use personally, or require special configuration. Nothing wrong with that, but these should be mentioned.
- jrm4 6y ago(YMMV for all the below...) Having done this sort of thing for years, I've come to realize that the biggest barrier to getting more efficient on the command line isn't "sets of features," i.e. the space of the things the shell can do -- it's figuring out how to retrain myself? A common thing: I see a new (to me) thing like fzf or fd and can immediately conceive of how adding it to my workflow would be phenomenal, but it takes so much more to make it a part of the day. I'm curious if anyone has come up with ways to teach/train themselves better? The best I've come up with so far is to just add something stupid to my .bashrc like echo "hey, try out that fzf trick"
- mgalgs 6y ago> take And if you use my (8 year old) PR you can "take" remote URLs, downloading and extracting tarballs and cloning git repos: https://github.com/ohmyzsh/ohmyzsh/pull/2029 https://github.com/ohmyzsh/ohmyzsh/pull/2029 Example: take https://github.com/torvalds/linux.git # you're now in the cloned directory