Posts tagged: cli

All posts with the tag "cli"

96 posts latest post 2026-04-29
Publishing rhythm
Apr 2026 | 1 posts

tmux new-window

https://youtu.be/YRPZBv-iYyE New window as it sounds makes new windows in tmux. Windows are kind of like tabs. They are another screen within your sessions that you can name and make new panes in. Default key bindings for creating and navigating windows in tmux. bind-key c new-window bind-key p previous-window bind-key n next-window As always I have rebound these keys because I generally prefer a single keystroke over the prefix plus keybinding approach that tmux gives by default. #――windows―――――――――――――――――――――――――――――――――――――― bind -n M-c new-window -c '#{pane_current_path}' bind -n M-p previous-window bind -n M-n next-window When I started using tmux I did almost everything in one giant session with many panes and windows. It became a nightmare to manage and quickly get between two sets work efficiently. This year I leaned in on sessions quite heavily. Checkout this 👇 post to see that workflow in depth. How I navigate tmux in 2021 [1] for more information on how I navigate ...

tmux slect-pane

https://youtu.be/CPZJZjN9YTY These are my MOST often used keybindings that I use in tmux. They allow me to jump between splits with ease with a vim style layout. I can hold mod and jump between panes with a familiar arrow key. bind -n M-h select-pane -L bind -n M-l select-pane -R bind -n M-k select-pane -U bind -n M-j select-pane -D How I navigate tmux in 2021 [1] for more information on how I navigate tmux, check out this full post References: [1]: /tmux-nav-2021/

tmux rotate-window

https://youtu.be/06z5qf81ofo Rotate window is the main way that I navigated tmux before I learned select-pane. It allows you to change your focused pane, or rotate the position of the panes easily. Default keybindings bind-key C-o rotate-window bind-key o select-pane -t :.+ My keybindings look just a bit different than the default ones, I do not like needing to hit prefix for every command, especially for repeated commands. I set a similar keybinding to the default one that uses mod instead of prefix. bind -n M-o select-pane -t :.+ bind -n M-O rotate-window How I navigate tmux in 2021 [1] for more information on how I navigate tmux, check out this full post References: [1]: /tmux-nav-2021/

tmux select-layout

https://youtu.be/F0mHnwTrNNc When you get many splits going in tmux sometimes its time for a new layout. There are four layout strategies that I use, main-vertical, main-horizontal, even-vertical, even-horizontal. Almost always I am useing the main ones with mod plus a or mod plus shift a keybindings. # Select Layouts #――――――――――――――――― bind -n M-a select-layout main-vertical bind -n M-A select-layout main-horizontal bind -n M-E select-layout even-vertical bind -n M-V select-layout even-horizontal How I navigate tmux in 2021 [1] for more information on how I navigate tmux, check out this full post References: [1]: /tmux-nav-2021/

tmux resize-panes

https://youtu.be/hpFYE2LU7xc Resizing panes in tmux can be quite difficult in default tmux, I use a set of keybingings to help resize panes in the rare occasions that I do need just a bit more space. I set the keybinding to the same as my split navigation bindings but shifted. They are very vim like (h,j,k,l). # resize panes #――――――――――――――――――――――――――――― bind -n M-H resize-pane -L 2 bind -n M-L resize-pane -R 2 bind -n M-K resize-pane -U 2 bind -n M-J resize-pane -D 2 Most often when I need to resize panes I just grab the edge of the pane with my mouse. Yes the mouse, its not that often that I actually need to change the size of a pane. # Enable mouse control (clickable windows, panes, resizable panes) set -g mouse on How I navigate tmux in 2021 [1] for more information on how I navigate tmux, check out this full post References: [1]: /tmux-nav-2021/

tmux choose-tree

https://youtu.be/79Y-kqAiMpw Choose tree is a powerful tmux utility that provides a graphical interface to preview all sessions, windows, and panes, move between them kill them, move them and much more. The default keybinding bind-key -T prefix s choose-tree -s my preferred keybinding to open sessions and windows collapsed and Zoomed in. bind-key j choose-tree -swZ From the man page. choose-tree [-GNrswZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template] Put a pane into tree mode, where a session, window or pane may be chosen interactively from a tree. Each session, window or pane is shown on one line. A shortcut key is shown on the left in brackets allowing for immediate choice, or the tree may be navigated and an item chosen or otherwise manipulated using the keys below. -s starts with sessions collapsed and -w with windows collapsed. -Z zooms the pane. The follow‐ ing keys may be used in tree mode: Key Function Enter Choose selected i...

tmux prefix

https://youtu.be/BMkpbfhbkKM The prefix key is an essential part of tmux, by default all of tmux’s key-bindings sit behind a prefix. This prefix is very similar to vim’s leader key. It is common for folks to change the default C-b (control b) to C-a or if they are a vim user something to match their vim leader key. set -g prefix C-Space bind Space send-prefix A few of the essential default key-bindings. % vertical split " horizontal split d detach up select up one pane down select down one pane right select right one pane left select left one pane t clock o swap panes c create window n next window p previous window A more complete list of key-bindings can be found in this gist https://gist.github.com/mzmonsour/8791835. How I navigate tmux in 2021 [1] for more information on how I navigate tmux, check out this full post References: [1]: /tmux-nav-2021/

tmux splitting panes

https://youtu.be/kzgyiHap1nQ splitting panes is a core feature of tmux. It allows us to split the terminal vertically or horizontally into new panes. bind -n M-s split-window -c '#{pane_current_path}' bind -n M-v split-window -h -c '#{pane_current_path}' bind -n M-X kill-pane 🗒️ note that ‘#{pane_current_path}‘will keep the split in the same directory as it’s parent, without this it will default to your home directory. How I navigate tmux in 2021 [1] for more information on how I navigate tmux, check out this full post References: [1]: /tmux-nav-2021/

tmux last session

https://youtu.be/RB87EEnnMnU An ultimate productivity key-binding in tmux is one to switch to the last session. I use this to quickly get between sessions really quick. Often I am working and need to lookup a quick note, or copy something into my notes, then get back to where I was quickly. bind -n M-b switch-client -l I think of this hub and spoke model, and use last-session to quickly drive it. [1] How I navigate tmux in 2021 [2] for more information on how I navigate tmux, check out this full post References: [1]: https://images.waylonwalker.com/tmux-nav-hub-spoke.png [2]: /tmux-nav-2021/

tmux floating popups

https://youtu.be/2ZqFDsJywt8 Tmux popups are actually floating windows that you can drag around the screen. They always open in the middle (by default) when you open them, no matter where you leave them. Here are a couple of keybindings I use to open up popup windows. bind C-g display-popup -E "ta ~/git" bind -n M-g display-popup -E "tmux new-session -A -s scratch" How I navigate tmux in 2021 [1] for more information on how I navigate tmux, check out this full post References: [1]: /tmux-nav-2021/

tmux popups

https://youtu.be/2I8fB28zfB4 Tmux-popups are a great feature that is relatively new to tmux, many repos such as the standard ubuntu repos do not have it. Popups came in 3.2a, if your package manager does not have it, you can follow the tmux’s install instructions [1] to build from source. # open a popup scratchpad bind -n M-g display-popup -E "tmux new-session -A -s scratch" How I navigate tmux in 2021 [2] for more information on how I navigate tmux, check out this full post I use popups quite a bit in my workflow to ssh into another machine for a short period, or make a new project with a template. References: [1]: https://github.com/tmux/tmux#installation [2]: /tmux-nav-2021/

Copy and Paste on Linux

These are the notes that I used as I set up my first ever ubuntu desktop. gnome-tweaks # [1] sudo apt install gnome-tweaks nordix gtk theme # [2] I ran this, but have no idea if it had any effect as the theme did not show up until I relogged. gsettings set org.gnome.desktop.wm.preferences theme Nordic What I think actuagnome terminal showing scrollbar in tmuxlly worked was emoji support # [3] One thing that I really missed quite early from windows was the emoji virtual keyboard. I like being able to quickly toss in those emoji that give just a bit of a visual cue 🔥, ⚠️,, 🎉, 🦄, 💜. installation # [4] I found an application called emote. that seems to do everything I need it to in the snap store. Installation is a typicall snap install. sudo snap install emote default keybinding # [5] The application came with a default keybinding ctrl+alt+e, but I could never remember it. ctrl+alt+e Windows keybinding # [6] Old habits are hard to break, I opened up the gnome settings a...

How to use git cherry pick

~/git via 🐍 v3.8.5 ❯ mkdir git-cherry-pick-learn ~/git via 🐍 v3.8.5 ❯ cd git-cherry-pick-learn ~/git/git-cherry-pick-learn ❯ git init Initialized empty Git repository in /home/walkews/git/git-cherry-pick-learn/.git/ git-cherry-pick-learn on  main ❯ touch readme.md git-cherry-pick-learn on  main [?] ❯ git status On branch main No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) readme.md nothing added to commit but untracked files present (use "git add" to track) git-cherry-pick-learn on  main [?] ❯ git add . git-cherry-pick-learn on  main [+] ❯ git commit -m "init readme" [main (root-commit) ebd1ff2] init readme 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 readme.md git-cherry-pick-learn on  main ❯ echo "Learn Cherry Pick" Learn Cherry Pick git-cherry-pick-learn on  main ❯ git add . git-cherry-pick-learn on  main ❯ git commit -m "add title git-cherry-pick-learn on  main ❯ echo "# Learn Cherry P...

How I navigate tmux in 2021

change_speed = (speed) => [...document.querySelectorAll('video')].map(v => v.playbackRate=v.playbackRate+speed) In 2021 I changed the way I navigate between tmux sessions big time. Now I can create, kill, switch with ease, and generally keep work separated into logical groups. Update # [1] Since making this post, I have made ~20 other posts in short form that all have a YouTube video to go along with them you can find them all on my tmux-playlist [2]. Chris Toomey’s [3] Tmux Course # [4] I took Chris’s tmux course [5] in December 2020 and it was fantastic. Even as a seasoned tmux user, I learned quite a bit. Before the course, I was proficient in navigating within each of my tmux sessions but rarely started more than one session. A few months later, I have adopted a lot of what I learned from Chris and made it my own. I am now keeping projects to their own session and can move between them fluidly with just a few keystrokes. For high-traffic projects, I have them bound to a si...

Trim unused git branches

Trim branches no longer on origin # [1] git remote prune origin --dry-run git remote prune origin Find branches already merged # [2] git checkout main # list remote branches that have already been merged into main git branch -r --merged # list local branches that have already been merged into main git branch --merged References: [1]: #trim-branches-no-longer-on-origin [2]: #find-branches-already-merged

Create a Virtual File Gallery with Symlinks

Creating a directory that is a union of several directories can be achieved with a few symlinks at the command line. Creating a Virtual File Gallery # [1] Here is how I am creating a virtual directory of all my projects that is a combination of both work and not-work projects. I am creating symlinks for every directory under ~/work and ~/git. rm -rf ~/projects mkdir ~/projects ln -sf ~/work/* ~/projects ln -sf ~/git/* ~/projects ⚠ Notice that first I am recreating the directory each time. This will ensure that any project that is deleted from their actual directory is removed from the virtual gallery. Updating the gallery # [2] Since links are always kept up to date without any extra work, all the data is still in the same place it started. But as new directories are added to any project directory they will not be automatically added to the virtual gallery. - cron - bashrc/zshrc If you’re concerned about system resources, you can add it to a cron job to run at a regular sch...

How to Install micromamba on linux (from the comamnd line only)

I really like using conda (miniconda) as my python virtual environment [1] manager of choice. It’s simple and it includes its own python interpreter using the version that I specify at creation. Mamba # [2] from their readme [3] --- Mamba is a reimplementation of the conda package manager in C++. - parallel downloading of repository data and package files using multi-threading - libsolv for much faster dependency solving, a state of the art library used in the RPM package manager of Red Hat, Fedora and OpenSUSE - core parts of mamba are implemented in C++ for maximum efficiency At the same time, mamba utilize the same command line parser, package installation and deinstallation code and transaction verification routines as conda to stay as compatible as possible. --- Installing Micromamba # [4] Similar to miniconda micromamba can be installed with a few lines of bash wget -qO- https://micromamba.snakepit.net/api/micromamba/linux-64/latest | tar -xvj bin/micromamba ./bin/...

Vim Wsl Clipboard

I’ve long used neovim from within windows wsl, and for far too long, I went without a proper way to get text out of it and into windows. wsl has access to cmd applications # [1] wsl can access clip.exe. You can do some cool things with it, such as cat a file into the clipboard, sending output from a command to the clipboard, or set an autocmd group in vim to send yank to the windows clipboard. using clip.exe # [2] Let’s say you want to send a teammate the tail of a log file over chat. You can tail the file into clip.exe. tail -n 1 info.log | clip.exe pipe streams of text into clip.exe make it a bit more natural # [3] I recently made mine feel a bit more natural by aliasing it to clip. alias clip=clip.exe pop this in your ~/.bashrc or ~/.zshrc yanking to windows clipboard from vim # [4] I use neovim as my daily text editor and its a pain to share code with a teammate over chat, stack overflow, into a gist, or whatever you need. The following snippet has been quite useful ...

Quickly Edit Posts

Recently I automated starting new posts with a python script. Today I want to work on the next part that is editing those posts quickly. Automating my Post Starter [1] Check out this post about setting up my posts with python 🐍 Enter Bash # [2] For the process of editing a post I just need to open the file in vim quickly. I dont need much in the way of parsing and setting up the frontmatter. I think this is a simple job for a bash script and fzf. - change to the root of my blog - fuzzy find the post - open it with vim - change back to the directory I was in bash function # [3] For this I am going to go with a bash function. This is partly due to being able to track where I was and get back. Also the line with nvim will run fzf everytime you source your ~/.alias file which is not what we want. Lets setup the boilerplate. Its going to create a function called ep "edit post", track our current directory, create a sub function _ep. Then call that function and cd back to where...

If Tmux

I do much of my work from tmux, I love it so much that I want to setup some functionality that puts me in tmux even if I didn’t ask for it. Bash Function # [1] Bash function to check if the shell is in a tmux session. in_tmux () { if [ -n "$TMUX" ]; then return 0 else return 1 fi } Using the bash function # [2] I often open up vim to do some quite edits, but before I know it I have several splits open and I need access to another shell utility, but I forgot to start in tmux. This function makes sure tht I start in tmux everytime. Using if_tmux to ensure vim is opened in tmux. vim () { in_tmux \ && nvim \ || bash -c "\ tmux new-session -d;\ tmux send-keys nvim Space +GFiles C-m;\ tmux -2 attach-session -d; " } I am not quite sure if this is proper use of the && and ||, let me know if you have a better way to do one thing if in_tmux returns true and another if it returns faslse. References: [1]: #bash-function [2]: #using-the-bash-function