|
| 1 | ++++ |
| 2 | +title = "A Network Engineers guide to powering up your shell" |
| 3 | +date = "2025-04-02" |
| 4 | +description = "Using zsh, powerlevel10k and tmux for a great shell experience" |
| 5 | +tags = [ |
| 6 | + "linux", |
| 7 | + "shell", |
| 8 | + "zsh", |
| 9 | + "tmux", |
| 10 | +] |
| 11 | +categories = [ |
| 12 | + "linux", |
| 13 | +] |
| 14 | +series = ["Linux Shell"] |
| 15 | +image = "images/title.png" |
| 16 | ++++ |
| 17 | + |
| 18 | +## Introduction |
| 19 | + |
| 20 | +This repo expands on the basic tmux shell by moving from bash to zsh, adding the popular [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh) plugin and, adding the [powerlevel10k](https://github.com/romkatv/powerlevel10k) theme for a speedier and modern looking shell. |
| 21 | + |
| 22 | +Repository here https://github.com/commitconfirmed/tmux-p10k-for-neteng/ |
| 23 | + |
| 24 | +## Try it out |
| 25 | + |
| 26 | +Just click the "Open in GitHub Codespaces" button below! (github account required) Should see a terminal that looks similar to the below: |
| 27 | + |
| 28 | +[](https://codespaces.new/commitconfirmed/tmux-p10k-for-neteng?quickstart=1&devcontainer_path=.devcontainer%2Fdevcontainer.json) |
| 29 | + |
| 30 | +<img src="images/title.png" alt="Codespaces terminal window"> |
| 31 | + |
| 32 | +## Installation |
| 33 | + |
| 34 | +Follow the below step by step guide to set this up on your own machine: |
| 35 | + |
| 36 | +- Install zsh (https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH) |
| 37 | +- Install Oh-my-zsh (https://ohmyz.sh/#install) and follow the prompts |
| 38 | +- Install the powerlevel10k theme and the zsh-autocomplete plugin |
| 39 | + |
| 40 | +```sh |
| 41 | +apt-get install zsh |
| 42 | +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
| 43 | +git clone --depth=1 https://github.com/marlonrichert/zsh-autocomplete.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autocomplete |
| 44 | +git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k |
| 45 | +``` |
| 46 | + |
| 47 | +## Setup |
| 48 | + |
| 49 | +- In your `~/.zshrc` file, change the ZSH_THEME and set your plugins of choice |
| 50 | + |
| 51 | +> Builtin plugins available at https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins if you want to further personally customise |
| 52 | +
|
| 53 | +```sh |
| 54 | +ZSH_THEME="powerlevel10k/powerlevel10k" |
| 55 | + |
| 56 | +plugins=( |
| 57 | + python |
| 58 | + golang |
| 59 | + zsh-autocomplete |
| 60 | + colored-man-pages |
| 61 | +) |
| 62 | +``` |
| 63 | + |
| 64 | +- There are some additional steps depending on your disrto in the [zsh-autocomplete](https://github.com/marlonrichert/zsh-autocomplete) plugin to follow |
| 65 | +- Restart zsh with `source ~/.zshrc`, this should now display the powerlevel10k configuration wizard which you can run through with your own personal preferences |
| 66 | + |
| 67 | +> If you do not like your powerlevel10k look, you can always run the configuration wizard again with `p10k configure`. |
| 68 | +> My TMUX theme is aligned with the classic prompt style |
| 69 | +
|
| 70 | +- If you do not want to use TMUX then you are now good to go! Two more things I add for my own personal comfort are below |
| 71 | + |
| 72 | +```sh |
| 73 | +# Add to your .zshrc towards the bottom (but not on the last line) |
| 74 | +# Make your prompt start at the bottom of the screen on startup |
| 75 | +print ${(pl:$LINES::\n:):-} |
| 76 | +# Cap the maximum number of lines for autocomplete to 6 |
| 77 | +zstyle ':autocomplete:*:*' list-lines 6 |
| 78 | +``` |
| 79 | + |
| 80 | +## Add TMUX |
| 81 | + |
| 82 | +Pretty much every modern linux distribution these days has tmux installed by default. If not simply install tmux using your distributions package manager. |
| 83 | + |
| 84 | +To use my tmux configuration, simply copy and paste the contents of my [.tmux.conf](https://github.com/commitconfirmed/tmux-p10k-for-neteng/blob/main/.tmux.conf) file into your home directories `~/.tmux.conf` |
| 85 | + |
| 86 | +## Usage |
| 87 | + |
| 88 | +TMUX should automatically start when you SSH into your host if you have copied my [aliases.zsh](https://github.com/commitconfirmed/tmux-p10k-for-neteng/blob/main/aliases.zsh) file into your setup. |
| 89 | + |
| 90 | +If not you can simply execute `tmux -u attach -t COMMITCONFIRMED || tmux -u new -s COMMITCONFIRMED` replacing "COMMITCONFIRMED" with whatever name you want at the bottom. |
| 91 | + |
| 92 | +Keybindings I've used as a personal preference, you can change this if you want in your own .tmux.conf file to suit your own preferences. Mousewheel scrolling and clicking of the tabs also should work. |
| 93 | + |
| 94 | +| Keybind | Description | |
| 95 | +| ------------------------- | --- | |
| 96 | +| `Ctrl+Space + c` | Create new window | |
| 97 | +| `Ctrl+Space + Ctrl+Space` | Switch between current and last window (can hold down Ctrl) | |
| 98 | +| `Ctrl+Space + 1-9` | Switch to window # | |
| 99 | +| `Ctrl+Space + [` | Switch to scrollback mode, can use VIM bindings here to search, etc. Press Enter twice to exit | |
| 100 | +| `Ctrl+Space + -` | Create a Horizontal Split | |
| 101 | +| `Ctrl+Space + =` | Create a Vertial Split | |
| 102 | +| `Alt+Arrow Keys` | Navigate between Split Panes | |
| 103 | +| `Ctrl+Space + d` | Detach TMUX | |
| 104 | +| `Ctrl+Space + r` | Reload TMUX config | |
| 105 | + |
| 106 | +## Acknowledgements |
| 107 | + |
| 108 | +If you found this post useful, please show your support by sponsoring or at least giving a star to the below repositories who are the ones that made this possible: |
| 109 | + |
| 110 | +- https://github.com/ohmyzsh/ohmyzsh |
| 111 | +- https://github.com/marlonrichert/zsh-autocomplete |
| 112 | +- https://github.com/romkatv/powerlevel10k |
0 commit comments