ZSH: The better shell

Your shell is bad, but doesn't have to be

I get a lot of questions on why I use a shell as opposed to a GUI for things. A shell is often annoying to do some basic things even if it's much more powerful and generally a tradeoff. Deleting all files ending in .txt is hard in a gui, but in a shell is just rm *.txt. Meanwhile, going up a directory in a gui is easy. Just hid the back button on the mouse. In a shell it's cd .. which is a lot to type for something so simple. Another common issue that I had was different operating systems or even Linux distros having different commands to do basically the same thing. On Debian it's sudo apt install <package> and Mac it's brew install <package>. This gets quite annoying to have to remember what system you are on, and understand the differences in them.

Aliases, functions, and bliss

All of the above complaints can go away. Changing directories can be shortened.

# Changing dirs with just dots.
alias .='cd ../'
alias ..='cd ../../'
alias ...='cd ../../../'
alias ....='cd ../../../../'

This is just one example. Maybe you want to have commands that work on both Mac and Linux. What if it even matters if you are running Wayland or X11? Still can be easily solved.

if command -v pbcopy > /dev/null 2>&1; then
  alias xclip='pbcopy'
elif command -v wl-copy > /dev/null 2>&1; then
  alias xclip='tee >(wl-copy) | wl-copy -p'

The above makes xclip be the actual xclip if there are no better options, or sets it to the Mac or Wayland version if those exist instead. No need to remember what system you are on, or what software stack. It automatically adapts.

Package management.

I'll mostly let the code speak for itself as it's easy to understand, but this makes traveling between machines nearly seamless as there is nothing new to learn or remember.

if command -v xbps-install > /dev/null 2>&1; then
  export IS_VOID=1
elif command -v emerge > /dev/null 2>&1; then
  export IS_GENTO=1
elif command -v pacman > /dev/null 2>&1; then
  export IS_ARCH=1
elif command -v apt-get > /dev/null 2>&1; then
  export IS_DEBIAN=1
elif command -v apk > /dev/null 2>&1; then
  export IS_ALPINE=1
elif [[ "$OSTYPE" == "darwin"* ]]; then
  export IS_MAC=1
  export IS_BSD=1

if [ "${IS_ARCH}" = "1" ]; then
  ## Package Manager - pacman/yay
  if command -v yay > /dev/null 2>&1; then
    alias pi='yay -S'
    alias pr='yay -R'
    alias psearch='yay -Slq | fzf --multi --preview 'yay -Si {1}' | xargs -ro yay -S'
    alias pu='yay -Syu --devel --timeupdate'
    alias oneshot='yay -S --asdeps'
    alias orphans="yay -Qtdq | yay -Rns -"
    alias pi='sudo pacman -S'
    alias pr='sudo pacman -R'
    alias psearch='pacman -Slq | fzf --multi --preview 'sudo pacman -Si {1}' | xargs -ro sudo pacman -S'
    alias pu='sudo pacman -Syu'
    alias oneshot='sudo pacman -S --asdeps'
    alias orphans="pacman -Qtdq | sudo pacman -Rns -"
  alias mirrorupdate="sudo pacman-mirrors --geoip && sudo pacman -Syyu"
  alias etc-update="sudo pacdiff"
  alias asdep="sudo pacman -D --asdeps"
  alias explicit="sudo pacman -D --asexplicit"

elif [ "${IS_DEBIAN}" = "1" ]; then
  ## Package Manager - apt
  alias pi='sudo apt install'
  alias pr='sudo apt remove'
  alias psearch='apt search'
  alias pu='sudo apt update && sudo apt upgrade'
  alias orphans='apt autoremove'

elif [ "${IS_GENTOO}" = "1" ]; then
  ## Package Manager - portage/emerge
  alias gsync='sudo eix-sync'
  alias pi='sudo emerge -av --autounmask'
  alias oneshot='sudo emerge -av --oneshot'
  alias pu='sudo emerge --update --deep --with-bdeps=y --newuse --keep-going @world --ask'
  alias pub='sudo emerge --update --deep --with-bdeps=y --newuse --keep-going @world --ask --binpkg-changed-deps'
  alias pr='sudo emerge --depclean -av'
  alias psearch='eix -r'
  alias pclean='sudo qpkg -c'
  alias howlong='sudo watch --color genlop -uic'
  alias etcupdate='sudo -E etc-update --automode -3'

elif [ "${IS_ALPINE}" = "1" ]; then
  ## Package Manager - apk
  alias pi='sudo apk add'
  alias pr='sudo apk del'
  alias psearch='sudo apk search'
  alias pu='sudo apk update && sudo apk upgrade'

elif [ "${IS_VOID}" = "1" ]; then
  ## Package Manager - void/xpbs
  alias pi='sudo xbps-install -S'
  alias prr='sudo xbps-remove -R'
  alias pr='sudo xbps-remove'
  alias psearch='sudo xbps-query -Rs'
  alias pu='sudo xbps-install -Su'
  alias orphans='sudo xpbs-remove -o'

elif [ "${IS_MAC}" = "1" ]; then
  ## Package Manager - brew
  function pi {
      brew install "${@:1}"
      brew bundle dump --force --file=$HOMEBREW_BREWFILE
  function pic {
      brew install cask "${@:1}"
      brew bundle dump --force --file=$HOMEBREW_BREWFILE
  function pr {
      brew uninstall cask "${@:1}"
      brew bundle dump --force --file=$HOMEBREW_BREWFILE
  alias psearch='brew search'
  alias pu='brew update && brew upgrade'
  alias orphans='brew autoremove'

elif [ "${IS_BSD}" = 1 ]; then
  ## Package Manager - freebsd
  alias pi='sudo pkg install'
  alias pr='sudo pkg remove'
  alias psearch='sudo pkg search'
  alias pu='sudo pkg update && sudo pkg upgrade'


There is a combination of aliases and functions used in there. Aliases are simple commands, functions can have more advanced actions attached, but both act as a "normal" command as far as a user sees.

Adding sane defaults

A lot of the time you want to do the same thing. When you want to rm files, most of the time you probably want to remove a directory recursively, as opposed to deleting everything inside, and using rmdir. You can alias over commands and add default arguements.

# Default flags
alias cp='cp -R -i -v'
alias mv='mv -i -v'
alias mkdir='mkdir -p -v'
alias df='df -h'
alias du='du -h -s'
alias dd='dd status=progress bs=4M conv=fdatasync '
alias wgetpaste='wgetpaste -Xx'
alias sudo='sudo '  # Makes sudo work with aliases
alias ssh='TERM=xterm ssh'  # Fixes some issues with ssh on some terminals

More use of functions

I mentioned that functions can do a bit more than a basic alias. Here's a few more examples of that in action.

# Easy extract
extract () {
  if [ -f $1 ] ; then
      case $1 in
            *.tar.bz2)      tar xvjf $1   ;;
            *.tar.gz)       tar xvzf $1   ;;
        *.tar.xz)       tar xvJf $1   ;;
            *.bz2)          bunzip2 $1    ;;
            *.rar)          unrar x $1    ;;
            *.gz)           gunzip $1     ;;
            *.tar)          tar xvf $1    ;;
            *.tbz2)         tar xvjf $1   ;;
            *.tgz)          tar xvzf $1   ;;
        *.txz)          tar xvJf $1   ;;
            *.rar)          unrar $1      ;;
            *.zip)          unzip $1      ;;
            *.Z)            uncompress $1 ;;
            *.7z)           7z x $1       ;;
          *)           echo "don't know how to extract '$1'..." ;;
      echo "'$1' is not a valid file!"

# Makes directory then moves into it
function mkcdr {
    mkdir -p -v $1
    cd $1

# Creates an archive from given directory
mktar()  { tar cvf  "${1%%/}.tar"     "${1%%/}/"; }
mktgz()  { tar cvzf "${1%%/}.tar.gz"  "${1%%/}/"; }
mktbz()  { tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; }
mkzip()  { 7z a -r  "${1%%/}.zip"     "${1%%/}/"; }
mk7zip() { 7z a -r  "${1%%/}.7z"      "${1%%/}/"; }


I know this was a short post that was heavy in raw text from files, but it's meant to highlight some of my dotfiles that make my life much easier, and I think would be useful to many others. Even if you don't use the exact lines, you can see how things are used, get new ideas, and maybe make something even better for your workflow than you could just grab from using my files blindly. I didn't go deeply into things that bash can't do that ZSH can, but I may do a more in depth dive of my .zshrc to pull out some of those things at a later date. These are only snippits of my dotfiles. They can all be found, in full here for further reading and extraction. ZSH related files are .zshrc .zshenv .zsh_aliases as I have split my zsh for easier reading and editing.


Here are the aliases I use to open my zsh files for editing.

alias zshrc="$EDITOR ~/.zshrc"
alias zshenv="$EDITOR ~/.zshenv"
alias zshaliases="$EDITOR ~/.zsh_aliases"

PolyLite: ASA Red and Black

Hard to print, but rewarding

ASA is not at all like PLA. It's much stronger, resists temperature higher than 50c, and unlike ABS, it's even UV resistant. I wanted to start printing things that were able to be much stronger, and even mechanical. Gears, motor mounts, things near a printer's hotend, and much more will do much better out of ASA than they would out of something like PLA. ASA is much like ABS in regards to how it's harder to print. It has a tendency to warp when the surrounding air is under 50c because of the large difference between the printing temperature and the cooled temperature. Bed adhesion is also something to consider to help prevent warping. This is where I learned my first lesson with ASA. It really loves to stick to PEI sheets like the Prusa Mini has.


Damaged PEI sheet

While some small prints seemed to do great, I soon found that they stuck too well. Well enough that I had to pry the print off. Be very careful when printing with ASA to make sure that it's squished with your Z offset, but not enough to turn it white. I later learned that when it goes white, it's under stress, which causes a bond too strong, and leads to damaged PEI sheets. C'est la vie. I picked up some large kapton sheets, and swapped out the PEI sheets on both sides with that, and have been printing ever since. It doesn't stick nearly as hard to anything, which is both a plus, and a minus. It's a tradeoff I'd like to have as long as I have both PEI and Kapton available. If you ever damage a sheet too badly, order a new one, but save the old one for Kapton or painter's tape. Never know when it'll come in handy.

Back to printing!

With the sheet switched out, I learned a few things, and some were quite conflicting. The glass transition temperature of PolyLite ASA is apparently 97.5c, so you would want to run your bed temperature under that, as stated on the spool. However, my prusa mini lacks an enclosure, and should stay that way being built out of PETG, so putting the bed temperature at 100c and using a brim allowed me to get quite a strong grip on prints while printing, but it released instantly after cooling down without fail. If you are on PEI, I'd recomment trying without a brim, and keeping temperatures down, as well as bringing up your Z offset a bit to ensure that prints don't stick too well, but with Kapton tape, the settings I've listed seem to work great. When in doubt, print small objects, or calibration tests to test before you make the mistake I did.


This is not the "don't think, and just press print" that PLA has gotten me used to, but it's wonderfully strong, doesn't smell bad like ABS, and prints pretty reliably after getting it set up for your specific printer. I don't think I'd make ASA my default, but when something needs to be strong, ASA is my new go-to.

Polylite_ASA_Printing Polylite_ASA_Printing2 Polylite_ASA_Pile Polylite_ASA_Red

Prusament Mini: The endless upgrades

How I got here.

I'll be flat out here. Every one of these was done for fun. This printer is amazing out of the box, and while some can help print quality, done were done with the intent of getting better print quality unless otherwise noted.


Prusa Mini Base

I printed parts of this including the legs, some trays, and the PSU holder. The legs in theory offer better prints as the printer is more stable on the right side than it is stock. There's space for the spare bed under it, as well as room for a spool if I wanted to use that to keep it compact. Overall, I'd say that this is a pretty good upgrade, but was mostly printed to get used to the carmine red PETG.

Can be downloaded here

If I were to print this again, I would look at this lowered base, but I'm not really in it for the looks. It was a good learning experience, and took a bit of plastic, so I'll leave it as is.

Raspberry Pi case

With octoprint on board, you'll want a place to put your pi. Why not as part of the printer to keep it easy to move, store, and just generally clean? This works great with the base mod above, and was really easy to print. My only complaint is that the top took ages to print as it's a ton of z hops, but once it's printed, it's fantastic. Would recommend this to everyone.

Can be downloaded here

Blade duct

The cooling on the mini is fine as is, but I wanted to test the heat deflection on the PETG again, so I printed this. I did seem to get better cooling, though there was an issue with it hitting the bed at the far back. Luckily, there was someone that already noticed, and fixed that. If you don't need every last mm of the bed, the main part is amazing, and cools better, but if you want to just not think about it, I've also linked the mod that I also have now printed. I found no issues with PETG for this use, but printed the mod in ASA because I had it loaded in case you wonder why they aren't the same calour.

Can be downloaded here Fixed part here

Kapton bed

While I was printing PLA just fine on the stock smooth bed with PEI coating, unfortunately ASA had another thing to say about that bed, and fell in love with the sheet enough that it would never let go. Thus far, it seems to print PLA and ASA quite well, but doesn't grip as well as stock bed, which is both good for ASA, and bad for PLA. Overall, I wouldn't directly recommend this if your stock sheet works as intended, but in place of replacing a dead bed, they are a good value. Getting the PEI off was as easy as freezing the sheet, and pulling it up. The glue on the other hand, I'll leave for you to deal with, and won't even talk about, let alone recommend what I did to get it off.

Kapton sheets for Prusa mini

After thoughts

You can see the list of parts I don't use in front of the printer. The stock cooling bracket, the top of the electronics cabinet got replaced by the pi case, the Super Pinda mount was replaced on the new cooler, and the stock orange screen was replaced simply because I needed another test print for PETG, and it matched slightly better. I need to get a better way to mount my camera as opposed to a Nintendo Switch box, but it did the job while I look for something to print. If you have any other mods that you recommend that are printable, let me know and I may try them out. If I do, I'll be sure to update this page to include other mods.

Prusament PLA: Prusa Galaxy Black

Really pretty, easy to use

This filament looks absolutely stunning. I've printed keyboard cases, mac mini stand, mouse stand, and much more with this filament. It was absolutely perfect right out of the box on my Prusa Mini with settings available right in Prusa Slicer and there's really not much to say. PLA, as always, isn't great for mechanical applications, but is great at details on things that are used mostly for looks. If you just want something sitting around looking nice, this is a great choice.


corne artisans artisan sailboat

Prusament PETG: Prusa Carmine Red

Really pretty, hard to use

This filament has been the opposite experience of Galaxy Black PLA. Issues after issues getting it to stick, stringing was really bad, and details were lacking. That said, I did get some prints to work after much trial and error, and much of the issue with to do with Prusa's own textured sheet that was recommended for this. It is not safe to use on the smooth sheet as it will stick too well, but the textured sheet was the opposite. Prints not sticking, or breaking off constantly. Smaller prints normally needed to be fast, or use a brim, and large prints were able to stick if the first layer stuck. Once the print was done, on the rare print that did complete, stringing was rampant, and needed cleaned on every print. PETG is supposed to be better for structural components than PLA, but I found small pieces to break just as easily, and the heat deflection temperature is only 50c on PETG, so I can't recommend it. The main selling point of PETG was supposed to be that it was easy to print, and not give off toxic fumes like ABS/ASA and other similar materials, but it's been anything but easy to print. If you have tried PETG, and not had issue, and you don't have an enclosure for ABS/ASA, this may be a good option, but at least on the Prusa Mini, I can not recommend at least this PETG.


carmine_red_example carmine_red_print