Badass Terminal: WSL, macOS, and Ubuntu dotfiles update!!!

Today I’m super excited to announce that I pushed a pretty significant update to my dotfiles repo and bad ass terminal!

If you remember, my previous blog posts – Badass Terminal: FCU WSL Edition (oh-my-zsh, powerlevel9k, tmux, and more!) & macOS ohmyzsh + tmux + vim + iTerm2 + Powerlevel9k = Badass terminal blew up last year, and more recently, I thought – I should make this a pretty regular release.

At nearly every conference I speak I’m asked the same question – how do I get my terminal to look like yours? My previous posts walk through how to setup and configure your environments, but now there’s even greater functionality. Of course, these are my dotfiles and you do not have to use them. You could use the setup/configure scripts to simply install tools I use such as zsh, oh-my-zsh, powerlevel9k, tmux, vundle, nerdtree, etc., and configure your own, or you can use mine and modify as you see fit.

What does this new significant update include?

Responsive tmux

I made tmux responsive when you use my dotfiles. Previously, if the console window was less than a certain width, nothing would show because the amount of data I had in my .tmux.conf exceeded the width specified. Now, tmux will auto compensate for width and adjust automatically on the right-hand side. The smaller you make the window, the less data will appear on the right – I.E. Spotify info & battery info (on macOS), date, time will all start to disappear leaving just the hostname. The data on the left-hand side will remain unaffected for now.

PowerShell Optimized

When using my dotfiles with WSL you still need to use the wsl-terminal emulator I mentioned in my FCU WSL Edition post since the Windows Console VT still has trouble parsing the .sh files I use with tmux. With the help of Steven Murawski from The League, the install script now includes a check for admin rights, check for 7z install, configures PowerShell to use TLS 1.2 with Invoke-WebRequest, and creates a symlink instead of a shortcut. Overall, the code is cleaner and more explicit. Thanks Steven!

Formal support for macOS

Previously, I had an unmanaged repo where I just pushed dotfiles, but there was no configure script like I had for WSL/Ubuntu. There is now a formal branch for macOS here. This formal branch uses a brewfile to install a suite of tools I find necessary for my environment, as well as all the standard configuration options I have in the wsl branch. I even exported my iterm2 configuration and added that to the repo. When using my dotfiles, you will have to manually select the symlinked .itermcfg from the iTerm2 preferences and enter the path: ~/.itermcfg. Restart iTerm2 for changes to take effect.

Formal support for Ubuntu (16.04 and 17.10)

While others would use the WSL branch on full Ubuntu 16.04 and 17.10 installations, I never tested my configure.sh script for those environments. Now, in addition to formal testing, I have also optimized the configure and bootstrap scripts to include features specific to Ubuntu:

  • Copies gnome.profile colors and configures terminal (if selected to use my dotfiles)
  • Creates a symlink to the settings.json file in the dotfiles repo for VS Code (Solarized dark color scheme in VS Code on Ubuntu!)

Other general updates (WSL/Ubuntu/macOS):

  • Adds in “k” alias for kubectl to .zshrc
  • Added packet loss data in tmux status bar
  • Added speedtest data (download and upload bandwidth info) in tmux status bar
  • Updated how public IP address data is parsed in tmux status bar
  • Updated az cli install
  • Updated vim color scheme and added vim airline plugin
  • New font added to repo (Source Code Pro Nerd Font Complete Mono)

Here are pics of all 3 environments using my current dotfiles published today:

Things to note:

Fonts and Themes:

You still need to install a font to use some of the Unicode characters I have in my configuration.  WSL Terminal Emulator, iTerm2 and Ubuntu/WSL support mono fonts so you can choose whichever patched mono font you want. I recommend picking one from Nerd Fonts. For more of a “how-to” please refer to the original FCU Badass Terminal blog post.

Overall, with each update, I’m loving WSL more and more. I was incredibly impressed when I discovered I could use the same configure.sh script interchangeably between WSL and a full blown Ubuntu 16.04/17.10 system and have the install work the same way. Full disclosure: I am using WSL as part of the Windows 10 Inside Preview Program, but I found so are most of you! As always, feedback is welcome and encouraged. And if you have any ideas of what could make these dotfiles even more badass, submit a PR!

NOTE: It was brought to my attention by Scott Rankin that there are some additional modifications required that are not explicitly mentioned here. If you’re using WSL and the WSL Terminal Emulator I mentioned, you might notice bash is still starting by default. This is actually related to how wsl-terminal configures their environment, as it does not appear to listen to the chsh command. To fix this, you will find a wsl-terminal.conf file in the /mnt/c/Users/[UserProfile]/wsl-terminal/etc directory. You need to comment out line 4 and uncomment line 6. You can see the file and the line where zsh is set as the main shell here: https://github.com/goreliu/wsl-terminal/blob/master/src/etc/wsl-terminal.conf#L6. After setting zsh as your default shell in the wsl-terminal.conf, restart it and you should see zsh as your default shell, and subsequently, all the other tools used in my dotfiles (presuming you opted to use them).

Reminder: All of my posts are provided "AS IS", imply no warranties, and confer no rights or special privileges. Use of included postings, code samples and other works are subject to the terms specified at Microsoft. For more information, click here.

Comments 27

  • Thanks for the new update!

    I tried to go through this updated version using the links from the article and have run into a few weird issues. I also downloaded the dotfiles v1.1 release from [1] and ran the scripts/bootstrap and configure.sh scripts directly from this new ~/.dotfiles location. There was an error related to a missing [[ or something at what was I believe the previous prompt about whether or not you wanted to install the Azure CLI in both cases.

    The first and main issue is when I start the wsl-terminal from the desktop shortcut (wsl.lnk) the default shell is bash despite the fact that my user account shell should be /usr/bin/zsh (at least based on what’s in /etc/passwd and the output from running the configure script). I’m wondering if it’s how open-wsl.exe (at least the desktop shortcut) starts in /mnt/c/Users/Scott/Desktop rather than in /home/scott?

    And subsequently none of the other things are running.

    Do I need to be starting wsl-terminal differently?

    [1] https://github.com/jldeen/dotfiles/releases

    • Hi Scott!

      Thanks for replying and trying this out so quickly! Yes, the issue you’re running into is actually related to how wsl-terminal configures their environment. In the /mnt/c/Users/Scott/wsl-terminal directory, there is a wsl-terminal.conf file under the etc dir. You need to comment out line 4 and uncomment line 6. You can see the file and the line where zsh is set as the main shell here: https://github.com/goreliu/wsl-terminal/blob/master/src/etc/wsl-terminal.conf#L6. I will add a note for that in the blog post – do you have a github I can tag for pointing this out? After setting zsh as your default shell in the wsl-terminal.conf, restart it and you should see all the other tools. In a future release, I plan to automate that, however, there’s some interop parsing that needs to happen first.

      RE: The missing [[ – I will look into that – did you run into that issue when you ran the update from the one line command in the Readme.md?

      Thanks!

      • Thanks so much for the reply so quickly!

        I’ll go through the same setup on my home computer that I was trying before. I believe I saw that same [[ error when I did both but I’ll take better notes.

        My work github is scott-plutovr and my personal one is spaceacademy.

        You’ll have to forgive my ignorance as I am new to tmux. Are you doing anything special to get the multiple windows (in your picture it looks like terminal, a midnight commander looking window and a big vi on the right) or should that happen automatically with your .dotfiles? I’ll be looking for some tutorials online as soon as I get this configured.

        Thanks again!

        • Awesome! Thanks Scott! I’ll get the update posted and link your GitHub shortly. I tested the install scripts pretty extensively and never saw the [[ error so if you do see it, can you email me a screenshot? jessde@microsoft.com or send me it in a DM on twitter – jldeen. Also, any details about your environment would be super helpful! In fact, DMs tend to work better for me if you have Twitter.

          And RE: tmux – yes, tmux uses key bindings as what’s called prefixes. By default the key binding for tmux is ctrl + b, but many people, including myself, will unbind that and bind ctrl + a instead. So a common question as you start getting more into tmux is: “Are you a ctrl + b or ctrl + a person?” Similar to “tabs or spaces?” Haha… So, to explicitly answer your question, hit ctrl + a, followed by \ to split the screen vertically; similarly, hit ctrl + a, followed by – to split the screen horizontally. Another helpful tip – ctrl + a, followed by x will kill the current pane, too.

          You can see the bindings and my configuration in the tmux.conf.symlink file on lines 1-4. https://github.com/jldeen/dotfiles/blob/wsl/tmux/tmux.conf.symlink#L1-L4

          You can see the bindings for \ and – (split pane) on lines 53-57. https://github.com/jldeen/dotfiles/blob/wsl/tmux/tmux.conf.symlink#L53-L57

          You just gave me a good idea for a future blog post, too – one that explains my dotfiles for those new to tmux and custom terminals, and why I opted for the settings I chose.

        • Jessica,

          There were no weird errors when I just ran things from the various wsl url off the earlier post.

          I did change up the order slightly though.

          First I installed wsl-terminal.
          Next I adjusted the wsl-terminal.conf to make zsh the default instead of bash.
          Last I ran your configure.sh from bash -c "$(curl -fsSL https://raw.githubusercontent.com/jldeen/dotfiles/wsl/configure.sh)"

          During the various interactive sections of the script I chose to change my default shell and now on running the wsl shortcut from my desktop I see that if I echo $SHELL it reports /bin/zsh.

          I see the same status bar at the bottom of the terminal that shows bandwidth etc. but not the multiple terminal windows so I’m going to go study up on tmux!

          Cheers,
          Scott
          It must have been when I cloned your dotfiles repo into ~/.dotfiles and was trying to run configure.sh while at work where I saw that.

  • Hi Jessica,

    Thanks a lot for your work !

    I’ve been having the same problem ; my default shell is still bash and not zsh.
    After launching tmux manually, i see there is an error in internet_info.sh :

    https://i.imgur.com/JFoqIRB.png

    If I launch the bash file manually :

    I end up with the same [[ error

    https://i.imgur.com/QQV3BLH.png

    Weirdly enough, despite this error I then have the connection information displayed at the bottom of the window.

    I’m guessing this error is causing the rest of the installation to fail somehow. I tried setting zsh as my default shell manually with chsh but without luck (I’m on the last version of windows 10 and ubuntu has been installed through the store, after enabling WSL in the windows features).

    Regards,

    Pierrick

    • Hi Pierrick,

      I just added a note to the blog post – the same note I put in my comment with Scott. WSL Terminal Emulator isn’t using zsh as the default shell – this is actually related to how wsl-terminal configures their environment, as it does not appear to listen to the chsh command. To fix this, you will find a wsl-terminal.conf file in the /mnt/c/Users/[UserProfile]/wsl-terminal/etc directory. You need to comment out line 4 and uncomment line 6. You can see the file and the line where zsh is set as the main shell here: https://github.com/goreliu/wsl-terminal/blob/master/src/etc/wsl-terminal.conf#L6. After setting zsh as your default shell in the wsl-terminal.conf, restart it and you should see zsh as your default shell, and subsequently, all the other tools used in my dotfiles (presuming you opted to use them).

      Give that a shot and let me know if your issues persist.

      Thanks!

      • Thanks a lot, feel a bit stupid I did not see that.

        internet_info.sh takes some time to be operationnal, and Python.exe is using a lot of bandwith now and then, I suspect for the speed test at the bottom of the screen. I don’t know if the speedtest-cli is supposed to be launched every 10 seconds, seems odd.

        Except that, things are running smoothly, thanks a lot !

        • No need to feel stupid, I truly just added the note right before replying to your comment. Glad you were able to get it working. RE: Speed and performance, I know speedtest-cli is a bit slow, it’s the only tool I could find (without writing my own) that would source the data I wanted to include. It doesn’t need to run every 10 seconds – I’d be happy if it ran every 5 minutes. The issue, I believe, is how tmux sources the .sh files used in the status bar – tmux seems to call them every few seconds for a refresh. I’m open to PRs if you have an idea on how to handle that. It’s on my list of things to dive into after my next leg of travel!

  • One additional thing that I did is to make a new wsl.lnk shortcut on my Desktop that includes the ‘-l’ switch to run a login shell. I couldn’t modify the shortcut that was created when the wsl-terminal was installed so I just made a new one and added that -l. Now when I start wsl it automatically switches to my $HOME rather than in /mnt/C/Users/Scott/Desktop

    Overall I really like this. I’m new to both vi and tmux so it’s a bit of a learning curve but it’s fun! I found some decent tmux tutorials online and have been trying to use this at work. I haven’t had a chance to check out midnight commander.

    That said I do notice several times a day where it just appears to hang after I’ve started typing something. Is this the zsh autocompletion stuff? Something else with wsl? If I have the Windows Task Manager open at the same time it doesn’t appear that anything is consuming all of the computer CPU. I do see python2.7 using a decent amount of memory but it’s not out of control or anything. Any thoughts or suggestions on how to trace what’s happening?

    • Hi Scott,

      That’s great feedback. The wsl.lnk I actually create for users as part of the PS script is a symlink and not a shortcut – that might be why you couldn’t modify it. I’ll look into updating the shortcut/symlink to include the -l switch though, that’s a great idea!

      I’m so glad you like it and find it useful – your feedback from the WSL side has been immensely valuable. I mainly code on my Mac so getting insight from someone who uses WSL on the daily is great.

      RE: Performance – depending on which directory you’re working in, I know the powerlevel9k theme has some slow timing issues when in a git directory. I’ve talked to Ben (owner of the project) about it and it’s due to how they handle the VCS calls for git repos. They know the solution, (forking into async processes) but they just don’t have the bandwidth right now. If you know of anyone, or if you yourself would like to help, I know they would love the contribution. Here’s the Tweet where we are talking about it – https://twitter.com/jldeen/status/970113157074075649.

      The other area of performance degradation could be related to speedtest-cli and how tmux calls the .sh scripts. I mentioned this in my reply to Pierrick above – I know speedtest-cli is a bit slow, it’s the only tool I could find (without writing my own) that would source the data I wanted to include. The issue, I believe, is how tmux sources the .sh files used in the status bar – tmux seems to call them every few seconds for a refresh. It doesn’t need to run every 10 seconds – I’d be happy if it ran every 5 minutes. I’m open to PRs if you have an idea on how to handle that as well. Otherwise, I’ll dive into in my next release.

  • Oh and I did also notice one other thing. Despite the fact that it asks me for my GitHub user name and email address (and I see them when I run git config --list), I noticed on a commit on GitHub earlier that it was displayed as jldeen. I believe this might be because yours are still in the main .gitconfig.conf?

    • Ah, yet again – great catch! I’ll look into that. That sounds like a simple fix. Thanks again, Scott! Love all your comments on this post! I did append this post with my note from your initial point about the WSL Terminal Emulator and I linked your work Twitter.

  • Hiya there Jessica! Your script is fantastic. As I am a fan of Visual Studio Code, Bash, and all sorts of shinny-flashy things – so I find this to be quite awesome. One thing that I saw in your Azure CLI script (side note: we are going to be looking at K8s by the way and compare it to SF that we’ve been running for the last two years which is what has me looking at this) – is that the current signing key will expire in May of this year (2018). To get around that you can add the following to the script to get the latest key:

    curl -L https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –

    (reference: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest)

    Not sure if you were aware of that, but if not – hey cool. If so – great! Anyway, you are doing lots of great work and are a ton of fun. Keep being awesome and helping to make the world a better place. Cheers!

    • Hey Jerry! Thank you so much for your comment and positive words! I will be sure to update the script to get the latest key! In fact, if you’d like to send me a PR, I’ll happily merge it. All about collaboration and giving credit where credit is due.

  • Hi Jessica!

    Thank you for writing this article and “macOS ohmyzsh + tmux + vim + iTerm2 + Powerlevel9k = Badass terminal”.

    I would like to set up my iterm2 to work and look like what you have shown in those articles. When I visit your dotfiles repo for macos, there is a bash script to run under macos Configuration section in the README, but there is also an install section. Should I do both or is the installation section just for having the dotfiles saved on my machine? Also I already have configurations for zsh, oh-my-zsh, vim, and Powerlevel. WIll this override those configurations? I don’t mind having everything change to what you have as I am not experienced enough to have preferences yet, I just don’t know if I run the bash script you have listed under macos Configuration section in the README will create a bunch of conflicts.

    Once again thank you and great work!

    • Hi Justin – Thank you for your comment! Welcome to the wonderful world of a highly customized command line! Some people don’t like running scripts without first dissecting them, that’s what the install section is. The bash script command is a one-line command without the need to git clone or fork my repo – that’s probably the simplest method. I try to offer more than one method to accommodate individual preferences.

      In answer to your question, my script will prompt you if you want to use my dotfiles or if you want it to setup clean blank dotfiles for you to customize. Any existing dotfiles (your configs for zsh, vim, ps, etc.) will be backed up prior to any override. This allows you to always go back if you want. My script also sets up symlinks so everything is always synced. Example, if you opt to use my dotfiles, anytime I push a new change, you can simply do a git pull and the new updates will be applied. This allows you to seamlessly setup your terminal environment on any new Mac purchased.

      Thank you again for commenting! Take a pic when you get it setup and tag me on twitter! I’d LOVE that! @jldeen

      • Hi Jessica

        Thank you for the quick and helpful response. I ran the script and everything looks great! Just a few hiccups that I hope you don’t mind asking on here (I’ll keep any other issues I have on Github issues tab). My powerline now has question marks showing up and before I had powerline and there were no question marks (I found this GitHub issue but so far it hasn’t worked). You mentioned that I could go back to my setup I had prior to running the script (while running the script it asked me if I wanted to backup my dotfiles and I said yes to all). How do I revert back if I want to? What I was hoping I could do is have your setup on one iTerm2 profile and my old one on another but it looks like my old setups are gone in the profiles tab.

        Once again great work! I would send a picture on twitter but unfortunately, I am not on there.

        • Hi Justin,

          As mentioned in the blog post, when using my dotfiles, you do need to install the fonts provided in the GitHub repo? Did you install the fonts?

  • Hey Jessica

    Sorry for the back to back questions, but is there an uninstall script? I would like to go back and install your dotfiles manually so I can cherry pick the ones I like. If not can I just delete the .dotfiles directory or would that be a no no.

    Thank you!!

    • Hi Justin,

      I don’t necessarily have an uninstall script because the script provided is designed to preinstall all these tools for you. However, you can easily revert to clean dotfiles, allowing you to cherry pick your settings. Simply rerun the script again and select “no” when asked if you wish to use my dotfiles. This will backup the current ones, and setup new, clean, blank files for zsh and oh-my-zsh.

      Hope this helps!

      • Hi Jessica,

        I reran the script and selected no and now able to customize. Thank you for the help! I feel like a badass in the terminal now!

  • Hello! I’ve gotten this all setup and *almost* working – I’m so happy you published this script. It pretty accurately recreates my old setup env and adds a whole bunch more stuff I really like!

    I’m posting here now as I’m not able to paste into the terminal (WSL Terminal). Tried right-click, middle-click, ctrl-v and ctrl-ins and had no success. I’m diving into the config files to see if I can see what the default behavior is supposed to be, but an initial scan hasn’t shaken anything out yet. Is anyone able to point me in the right direction please?

    • Hey! So glad you like the script! I am still working through the WSL VT copy/paste issue/bug. It’s a known issue. Sadly, with my travel schedule, I haven’t had time. I do want to resolve it though! If anyone has a solution – please submit a PR! I’d love for this to be a community project!

      • Thanks for the rapid reponse, and my sympathies for living out of a suitcase. Actually it does seem to behave now, with shift-ins as the keypress.

        Next thing I’ll be looking at tweaking is when I’m SSHing about and several boxes have the dotfiles installed, I get stacks of the status bar for each host. I am sure this is probably a common typical usecase where there’s a way to consolidate this stuff automagically. Or possibly I’m just Doing It Wrong(TM).

Leave a Reply

Your email address will not be published. Required fields are marked *