Scripts I wrote that I use all the timeIn my decade-plus of maintaining my dotfiles, I’ve written a lot of little shell scripts. Here’s a big list of my personal favorites.Clipboardcopy and pasta are simple wrappers around system clipboard managers, like pbcopy on macOS and xclip on Linux. I use these all the time.# High level examples run_some_command | copy pasta > file_from_my_clipboard.txt # Copy a file's contents copy < file.txt # Open a file path from your clipboard vim "$(pasta)" # Decode some base64 from the clipboard pasta | base64 --decode pastas prints the current state of your clipboard to stdout, and then whenever the clipboard changes, it prints the new version. I use this once a week or so.# High level example pastas > everything_i_copied.txt # Download every link I copy to my clipboard pastas | wget -i - cpwd copies the current directory to the clipboard. Basically pwd | copy. I often use this when I’m in a directory and I want use that directory in another terminal tab; I copy it in one tab and cd to it in another. I use this once a day or so.File managementmkcd foo makes a directory and cds inside. It’s basically mkdir foo && cd foo. I use this all the time—almost every time I make a directory, I want to go in there.tempe changes to a temporary directory. It’s basically cd "$(mktemp -d)". I use this all the time to hop into a sandbox directory. It saves me from having to manually clean up my work. A couple of common examples:# Download a file and extract it tempe wget 'https://example.com/big_file.tar.xz' tar -xf big_file.tar.xz # ...do something with the file... # Write a quick throwaway script to try something out tempe vim foo.py python3 foo.py trash a.txt b.png moves a.txt and b.png to the trash. Supports macOS and Linux. I use this every day. I definitely run it more than rm, and it saves me from accidentally deleting files.mksh makes it quick to create shell scripts. mksh foo.sh creates foo.sh, makes it executable with chmod u+x, adds some ni...
First seen: 2025-10-22 18:26
Last seen: 2025-10-23 17:32