DEV Community

Cover image for My Terminal Setup: iTerm2 + Zsh πŸ”₯

My Terminal Setup: iTerm2 + Zsh πŸ”₯

Ali Spittel on July 31, 2018

As a follow up to my post on my text editor setup, I wanted to write about the other key part of my development setup -- my terminal. Unlike my rel...
Collapse
 
wolfhoundjesse profile image
Jesse M. Holmes

I love oh-my-zsh!

Everyone loves their splitting, multiplexing terminals, but I tried something different this timeβ€”I’ve been using i3wm for almost a year, and I really like it. If I need a new pane, I just pop open a new tile.

I’ve never asked if there is a difference between the two. Am I missing out by not using a multiplexer?

Collapse
 
ben profile image
Ben Halpern

Aside from feature sets, I really rely on love stories when picking out my dev tools.

oh-my-zsh! is one of those things I can't ignore the love for. I'm going to finally give it a dive.

Collapse
 
aspittel profile image
Ali Spittel

Yessss! it's amazing

Collapse
 
defman profile image
Sergey Kislyakov

I remember it being kinda slow. I'd recommend using zgen and loading only what you need from OMZ.

Collapse
 
robbyrussell profile image
Robby Russell πŸ˜πŸš‚

Thanks for loving Oh My Zsh! <3

Collapse
 
benjaminrood profile image
Benjamin Rood

Thank you for all your continued work on it, Robby!

Collapse
 
kungtotte profile image
Thomas Landin

On my Linux box I'm using Awesome WM, but it's the same principle. Why muck around with terminal panes when you have a whole window manager designed specifically for handling windows?

Bonus feature is that you can use any terminal you like without relying on it supporting panes/windows internally.

You typically also get multiple desktops with a window manager (called tags in awesome), so you can have a bunch of sysadmin terminals up on one tag and then either hit mod4+left/right to scroll to the next or hit mod4+number to jump to a specific one. I have mine set up to always open Firefox in a specific tag for example. You can configure different layouts for different tags, and swap layouts on the fly (awesome is a dynamic WM so it supports both tiling and floating windows).

Another bonus feature is it tiles/handles any type of window, not just terminals. So if you want two terminals, a gedit, and a browser up at the same time they all get tiled into the right place.

Collapse
 
benjaminrood profile image
Benjamin Rood

There's advantages of working in either way, but I'm looking forward to installing Awesome on my machine soon.
I think if you prefer to work on macOS Ali's way + a window management tool (BetterSnapTool is my favourite) is probably ideal.

Collapse
 
moopet profile image
Ben Sinclair

Yes - if you want to switch to a different session with a keyboard shortcut you have to use generic WM shortcuts and more importantly if you're on a foreign system and create a new terminal it'll be local. With a multiplexer it'll be logged into the remote system (and just as disconnectable as your original session)

Collapse
 
wolfhoundjesse profile image
Jesse M. Holmes

Oh, this! I remember, it’s just been a while. Thanks!

Collapse
 
sudiukil profile image
Quentin Sonrel

Same here for i3!

Collapse
 
mrquinn profile image
Michael

In case it's not clear, tree is not a shell built-in, it's the name of an external program (e.g. /usr/bin/tree.) Therefore it doesn't matter what shell you're using; either the program is installed or it isn't. Apt-get install tree, or brew install tree, or whatever other tool you use to install apps use that to install tree. ;)

Collapse
 
moopet profile image
Ben Sinclair

There's git tab-completion in bash as well if you turn it on.

I think that zsh has things to offer, but the things most people seem to talk about are available in bash if you want anyway. Zsh has some cooler globbing, but that's about it for me. I prefer to know bash well since it's much more likely to be the shell I'm using on a foreign system.

Collapse
 
stacy profile image
Stacy Montemayor

This is super timely for me! I just started fiddling with my terminal last week for the first time (I'm just starting to learn to code.) I upgraded to iTerm and like some of the features already. I'll be saving this to return to and read as I start to understand more.

Does anyone have any recommendations on an article or video for total newbie programmers setting up their terminals? Maybe more of a high-level overview?

Collapse
 
caiuscitiriga profile image
Caius Citiriga

Here you go! Hope you find it useful.

laracasts.com/series/setup-a-mac-d...

Collapse
 
stacy profile image
Stacy Montemayor

Thanks! I like his style too - I'm going to check out other videos.

Thread Thread
 
caiuscitiriga profile image
Caius Citiriga • Edited

You're welcome!

The guy speaking is Jeffrey Way. One of the most advanced Laravel's users. He's even a Laravel contributor for what I know, along with Taylor Otwell who's the actual creator.

Btw, Laravel is a PHP framework (a pretty robust one tho!)
On Laracasts you can find a lot of videos on Laravel of course, but there are a lot of other topics that doesn't concern the framework and still can be very helpful.

Like: Git me some version control, or "stand back i'm going to try regex", vue2, flexbox etc.

Some free some under subscription. But still, the free material has the same quality as the paid one.

Collapse
 
robbyrussell profile image
Robby Russell πŸ˜πŸš‚

I'm so delighted to see you mention Oh My Zsh in this article. Thanks for helping spread the word. :-)

Collapse
 
aspittel profile image
Ali Spittel

Ahh thanks for reading!! And for Oh My Zsh, it's amazing!

Collapse
 
nickytonline profile image
Nick Taylor

Fish autocompletion was what sold me on fish, but since hearing about Apple using zsh as the default terminal in the next major OS version, I decided to try zsh again. I got it setup fairly easily and I found a plugin that does the same thing as fish autocompletion, so switching back to zsh has been pretty transparent.

For those interested, here's the plugin.

I think I will have to update my Mac setup

or just do a write up on my zsh setup. πŸ˜‰

Collapse
 
mrquinn profile image
Michael • Edited

I love .oh-my-zsh and the plugins. Ie: git, sudo, z, colored-man-pages & dirhistory. I have used Konsole on Mint since 16 & now 19.

Collapse
 
robbyrussell profile image
Robby Russell πŸ˜πŸš‚

Thanks for sharing your favorite plugins, Michael!

Collapse
 
mrquinn profile image
Michael

Thank you for all your hard work making Oh-my-zsh such a gr8 add on for my nix boxes... it's a pleasure to use!

Collapse
 
tvanantwerp profile image
Tom VanAntwerp

Nice! I'm also iTerm + oh-my-zsh, using Powerlevel 9k for custom theme. I don't use panels--I've always just used tabs, as I keep the terminal window in a small corner of my workspace. I don't feel like it's made much difference.

Screenshot!

Tom's Terminal

Collapse
 
benjaminrood profile image
Benjamin Rood

Nothing to stop you using panes and tabs together!

Collapse
 
mrgnw profile image
Morgan • Edited

Yay!
Avit-pure is my fav oh-my-zsh theme, this is my version with a couple of tweaks:
github.com/mrgnw/mzsh/blob/master/...

(Like if you're in SSH it'll show πŸ“‘ so you don't accidentally mix up sessions)

Collapse
 
phantomhaze profile image
Alex Hernandez

A fellow spaceship user!

I may have to post about my own setup now, which selects a random prompt character each session. πŸš€β˜„οΈπŸ™ˆπŸ•

I did not know about the '...' alias! I may have to dig my hands into the zsh alias's, after seeing how it's improved your workflow.

Thanks for the article!

Collapse
 
holgeradam profile image
Holger Adam

Just the right time to update my ZSH config and finally fix some color issues. I use iTerm2 with the Light theme, because I found that staring at little white lines in a lot of black was uncomfortable.

I love the spaceship theme. Thanks for the inspiration!

Collapse
 
rattanakchea profile image
Rattanak Chea

What is a good alternative for Windows users, anyone?

Collapse
 
aspittel profile image
Ali Spittel

I use Hyper on my windows machine -- don't love it quite as much, but it's really extendible which is cool!

Collapse
 
benjaminrood profile image
Benjamin Rood • Edited

It looks fantastic and is customisable, as you say. Downsides are: too unstable, too slow. If only there was an iTerm port for Linux and Windows, too! :(
Truly, Nothing Compares 2 U, iTerm!

Collapse
 
arafel profile image
Paul Walker

I use MobaXTerm a lot at work. It's not quite in the same category as bash and zsh - it's a terminal, really - but it brings a lot of the Unix-y goodness to Windows.

It does tabs, and it'll connect via most protocols that you're likely to need.

Plus it comes with a built in X server, which I love - just being able to run a GUI program and have it work without having to fire up another server. :-)

mobaxterm.mobatek.net/

Collapse
 
kungtotte profile image
Thomas Landin

There's conemu and cmder, as well as Terminator. PowerShell is also really powerful, though it's not trying to be a *nix-style terminal so it's a bit different.

Collapse
 
chayanbaner profile image
chayan banerjee

I have recently started using Terminus, serves the purpose for me.
github.com/Eugeny/terminus

Collapse
 
erikthered profile image
Erik Nelson

Great post!

I think it was oh-my-zsh which initially pushed me to really customize my own dotfiles. It's a good way to get a nice terminal setup really quickly and then you can tweak away from there.

Collapse
 
oscherler profile image
Olivier β€œΓ–lbaum” Scherler

Are you using shell integration and triggers in iTerm2? I just finally got around to figure out what they’re for, and it’s awesome.

Shell integration detects your prompt so you can quickly navigate back to the star of the output of the previous command, for example. Saves you from having to clear your scrollback buffer before a command with a lot of output. It can also switch profiles depending on your username, host, or path.

Triggers can react to the output. I use it to pop a notification when Ansible is done running, to colour the run time of lengthy Ansible tasks, etc.

Collapse
 
anthonybronkema profile image
Anthony Bronkema

I had been using iTerm2 & ZSH in such a basic way... This helped me make it so much better! Thank you!

Collapse
 
johand profile image
Johan

Oh-my-zsh 🀘 take a look at tmux and tig

Collapse
 
shostarsson profile image
RΓ©mi Lavedrine • Edited

From that article, I changed my terminal and moved from a powerline classic terminal to a more fun one.
With emoji, I love it.

I didn't know the Spaceship prompt but I really love it.

Here is a quick picture of my terminal :

Collapse
 
aspittel profile image
Ali Spittel

Ah I like it! Looks good!

Collapse
 
johnnymast profile image
Johnny Mast

Ali,

I love your multiple panel open. For example i am a javascript game developer so i could now open "npm run watch" and "npm run serve" open in 2 panels. I already did this in iTerm but i did this in tabs. Your tip might be better for my situation.

Thanks!

Collapse
 
bdmorin profile image
Brian

Have you looked at kitty terminal? It's ridiculously performant, but requires conf file configuration.

Collapse
 
aspittel profile image
Ali Spittel

Oh cool! I haven't noticed any performance issues with my current setup, but that could be an awesome option as well!

Collapse
 
wolfhoundjesse profile image
Jesse M. Holmes

GPU based … does this mean I could do something cool with this dedicated graphics card I rarely turn on?

I’ve been using Termite for the last year. It’s easy.

Collapse
 
bdmorin profile image
Brian

GPU Rendering means it's really really fast. Some tests I ran went like this:

slack-files.com/T2ANEMZU1-FBT7X42E...

Alactritty: rg perl 7.28s user 28.04s system 21% cpu 2:43.80 total
iterm2: rg perl 7.15s user 26.87s system 0% cpu 58:14.69 total
kitty: rg perl 6.26s user 19.47s system 11% cpu 3:35.96 total
hyper: rg perl 6.65s user 16.02s system 25% cpu 1:27.68 total

So, things like tmux scrolling, vim scrolling, logfile scrolling are liquid smooth.

Collapse
 
emkographics profile image
Emko • Edited

Configured my terminal to look similar to the one in VSCode... Love it.

thepracticaldev.s3.amazonaws.com/i...

Collapse
 
felzan profile image
LuΓ­s Felipe Zanatto Alves

I use the Terminator on Ubuntu but miss so much the trigger option of iTerm2.
Someone knows something that does this job?

Collapse
 
nebojsac profile image
Nick Cinger

The only thing I miss since switching to Linux is iTerm2. Such a great piece of software... Well, at least I still have oh-my-zsh.

Thanks for sharing your setup!

Collapse
 
alvinmilton profile image
Alvin Milton

Using zsh from here on out. Been on iTerm for a while.

Collapse
 
_ronini profile image
Ronnie Villarini

Lol the acp function is killer, love it.
Going to install tree tomorrow! That looks outstanding.

Another awesome article, Ali. Thanks for sharing πŸ˜ƒ

Collapse
 
deanius profile image
Dean Radcliffe

Very helpful, thanks!

Collapse
 
kanishkadutta profile image
Kanishka Dutta

which font is that?

Collapse
 
edoxtator profile image
Doc

So my shop is 100% bash. How do you, a zsh user, work and play in that environment?

Collapse
 
aspittel profile image
Ali Spittel

I have a second computer that runs bash -- they're so similar that it's not a huge deal. Just really nice to have Zsh when its an option!

Collapse
 
codehakase profile image
Francis Sunday • Edited

Nice setup! I use iTerm2 with oh-my-zsh, and spend a lot of time there too, as my primary editor is vim, I use tmux for splitting panes and managing sessions.

Collapse
 
dineshbhagat profile image
DB • Edited

I customized and it looks like this

Collapse
 
scrozier profile image
Steve Crozier

Thanks for this. I was not keen on switching from bash, but you've made zsh sound almost fun! :-)

Collapse
 
eekayonline profile image
Edwin Klesman

Thanks for the read. I had to move on to zsh as Apple moved from bash to zsh. Reading your blog and using "Oh My Zsh" really made it an easy transition πŸ™ŒπŸ»

Love the spaceship info, really useful too!

Collapse
 
raipraveen83 profile image
Praveen Rai

Hi Ali,

is it possible for you to share your iterm2 theme used above? I really loved it. thanks

Collapse
 
willwinberg profile image
William

How have I lived without this?

Collapse
 
chiangs profile image
Stephen Chiang

Cool setup! For those who want instruction on how to install and play with zsh and oh-my-zsh, I wrote this article awhile back.

Collapse
 
marsxxl profile image
πŸ…ΌπŸ…°πŸ†πŸ†‚πŸ†‡πŸ†‡πŸ…»

Collapse
 
lexlohr profile image
Alex Lohr

Yes, zsh with oh-my-zsh is really, really awesome. I mostly use the terminal built into VS Code, so I don't have to leave the editor for shell jobs.

Collapse
 
saru profile image
Saru Subaschandran

Awesome! :)

Collapse
 
thomasmaitret profile image
Thomas Maitret

Zsh is amazing, but I personally use Fish Shell with oh-my-fish. Very easy to setup and use !

Collapse
 
kritoke profile image
Matt

I was about to comment on here about Fish. I moved from Bash to Fish and haven't moved back. I didn't know about oh my fish, so going to have to look into that one.