Posts tagged: bash

All posts with the tag "bash"

31 posts latest post 2025-11-26
Publishing rhythm
Nov 2025 | 1 posts

A super useful tool when doing PR’s or checking your own work during a big refactor is the silver searcher. Its a super fast command line based searching tool. You just run ag "<search term>" to search for your search term. This will list out every line of every file in any directory under your current working directory that contains a match.

It’s often useful to need some extra context around the change. I recently reviewed a bunch of PR’s that moved schema from save_args to the root of the dataset in all yaml configs. To ensure they all made it to the top level DataSet configuraion, and not underneath save_args. I can do a search for all the schemas, and ensure that none of them are under save_args anymore.

Creating a minimal config specifically for git commits has made running git commit much more pleasant. It starts up Much faster, and has all of the parts of my config that I use while making a git commit. The one thing that I often use is autocomplete, for things coming from elsewhere in the tmux session. For this cmpe-tmux specifically is super helpful.

The other thing that is engrained into my muscle memory is jj for escape. For that I went agead and added my settings and keymap with no noticable performance hit.

Here is the config that has taken

~/.config/nvim/init-git.vim

...

I really appreciate that in linux anything can be scripted, including setting the wallpaper. So everytime I disconnect a monitor I can just rerun my script and fix my wallpaper without digging deep into the ui and fussing through a bunch of settings.

feh --bg-scale ~/.config/awesome/wallpaper/my_wallpaper.png

I set my default wallpaper with feh using the command above.

Leaning in on feh, we can use fzf to pick a wallpaper from a directory full of wallpapers with very few keystrokes.

alias wallpaper='ls ~/.config/awesome/wallpaper | fzf --preview="feh --bg-scale ~/.config/awesome/wallpaper/{}" | xargs -I {} feh --bg-scale ~/.config/awesome/wallpaper/{}'

I have mine alias’d to wallpaper so that I can quickly run it from my terminal.

Stow is an incredible way to manage your dotfiles. It works by managing symlinks between your dotfiles directory and the rest of the system. You can then make your dotfiles directory a git repo and have it version controlled. In my honest opinion, when I was trying to get started the docs straight into deep detail of things I frankly don’t really care about and jumped right over how to use it.

When using stow its easiest to keep your dotfiles directory (you may name it what you want) in your home directory, with application directories inside of it.

Then each application directory should reflet the same diretory structure as you want in your home directory.

Here is a simple example with my zshrc.

...

tmux popups can be sized how you like based on the % width of the terminal on creation by using the flags (h, w, x, y) for height, width, and position.

# normal popup tmux popup figlet "Hello" # fullscreen popup tmux popup -h 100% -w 100% figlet "Hello" # 75% centered popup tmux popup -h 100% -w 75% figlet "Hello" # 75% popup on left side tmux popup -h 100% -w 75% -x 0% figlet "Hello"

example running these commands

I was completely stuck for awhile. copier was not replacing my template variables. I found out that adding all these _endops fixed it. Now It will support all of these types of variable wrappers

# copier.yml _templates_suffix: .jinja _envops: block_end_string: "%}" block_start_string: "{%" comment_end_string: "#}" comment_start_string: "{#" keep_trailing_newline: true variable_end_string: "}}" variable_start_string: "{{"

!RTFM: Later I read the docs and realized that copier defaults to using [[ and ]] for its templates unlike other tools like cookiecutter.

I’ve been looking for a templating tool for awhile that works well with single files. My go to templating tool cookiecutter does not work for single files, it needs to put files into a directory underneath of it.

By default copier uses double square brackets for its variables. variables in files, directory_names, or file_names will be substituted for their value once you render them.

# hello-py/hello.py.tmpl print('hello-[[name]]')

note! by default copier will not inject variables into your template-strings unless you use a .tmpl suffix.

Before running copier we need to tell copier what variables to ask for, we do this with a copier.yml file.

...

One of the most useful skills you can acquire to make you faster at almost any job that uses a computer is getting good at finding text in your current working diretory and identifying the files that its in. I often use the silver searcher ag or ripgrep rg to find files in large directories quickly. Both have a sane set of defaults that ignore hidden and gitignored files, but getting them to list only the filenames and not the matched was not trivial to me.

I’ve searched throught he help/man pages many times looking for these flags and they always seem to evade me.

Passing the flag -l to ag will get it to list only the filepath, and not the match. Here I gave it a --md as well to only return markdown filetypes. ag supports a number of filetypes in a very similar way.

ag nvim --md -l

rg #

Giving rg the --files-with-matches flag will yield you a similar set of results, giving only the filepaths themselves and not the match statement. Also passing in the -g "*.md" will similarly yield only...

pyenv provides an easy way to install almost any version of python from a large list of distributions. I have simply been using the version of python from the os package manager for awhile, but recently I bumped my home system to Ubuntu 21.10 impish, and it is only 3.9+ while the libraries I needed were only compatable with up to 3.8.

I needed to install an older version of python on ubuntu

I’ve been wanting to check out pyenv for awhile now, but without a burning need to do so.

Based on the Readme it looked like I needed to install using homebrew,so this is what I did, but I later realized that there is a pyenv-installer repo that may have saved me this need.

...

Installing brew on linux proved quite easy and got pyenv running for me within 4 commands.

I had never used homebrew before, honestly I thought it was a mac only thing for years. Today I wanted to try out pyenv, and the reccommended way to install was using homebrew. I am not yet sure if I want either in my normal workflow, so for now I am just going to pop open a new terminal and install homebrew and see how it goes.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/walkers/.zprofile eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

That was it, now homebrew is working. Starting a new shell and running the command to install pyenv worked.

When I first moved to vim from and ide like vscode or sublime text one of my very first issues was trying to preview my website at localhost:8000. There had always just been a button there to do it in all of my other editors, not vim. There are not many buttons for anything in vim. While there is probably a plugin that can run a webserver for me in vim, it’s not necessary, we just need the command line we are already in.

You will need a way to run another process alongside vim, here are a couple ideas to get you going that are not the focus here.style

Python already exists on most linux systems by default, and most are now on python3. If you are on windows typing python will take you directly to the windows store to install it, or you can also use wsl.

# python3 python -m http.server # running on port 5000 python -m http.server --directory markout 5000

# for the low chance you are on python2 python -m SimpleHTTPServer # running on port 5000 python -m SimpleHTTPServer 5000 python -m SimpleHTTPServer --directory markout 5000 

...

Open files FAST from zsh | or bash if thats your thing

https://youtu.be/PQw_is7rQSw

I am often in a set of tmux splits flying back and forth, accidentally close my editor, so when I come back to that split and hit my keybinds to edit files I enter them into zsh rather than into nvim like I intended. Today I am going to sand off that rough edge and get as similar behavior to nvim as I can with a couple of aliases.

Make sure you check out the YouTube video to see all of my improvements.

...

30 days dotfile ricing

https://youtu.be/Jq1Y48F_rOU

I am challenging myself to 30 days of dotfile ricing. I have been on linux desktop for a few months now and have a pretty good workflow going, I have the coarse edits done to my workflow, but it has some rough edges that need sanded down. It’s time to squash some of those little annoyances that still exist in my setup.

This is primarily going to be focused on productivity, but may have a few things to just look better. This will comprise heavily of aliases, zsh, and nvim config.

...

Update Alternatives in Linux

update-alternatives --query python update-alternatives: error: no alternatives for python sudo update-alternatives --install /usr/local/bin/python python `which python3.8` 2 # update-alternatives: using /usr/bin/python3.8 to provide /usr/local/bin/python (python) in auto mode sudo update-alternatives --install /usr/local/bin/python python `which python2.7` 5 # update-alternatives: using /usr/bin/python2.7 to provide /usr/local/bin/python (python) in auto mode update-alternatives --query python # Name: python # Link: /usr/local/bin/python # Status: auto # Best: /usr/bin/python2.7 # Value: /usr/bin/python2.7 # # Alternative: /usr/bin/python2.7 # Priority: 5 # # Alternative: /usr/bin/python3.8 # Priority: 2 sudo update-alternatives --install /usr/local/bin/python python `which python3.8` 20 # update-alternatives: using /usr/bin/python3.8 to provide /usr/local/bin/python (python) in auto mode

Trim unused git branches

Trim branches no longer on origin # git remote prune origin --dry-run git remote prune origin Find branches already merged # 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

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.

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.

...

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 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.

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.

...

2 min read