Living in the Shell #1
Written by Anachron on 2023-06-24
Read the article or go back.
# Introduction
I hereby introduce my mini-series: Living in the Shell
For a long time now I have been mostly living inside the linux shell
.
Because I got so many self-written little scripts, I wanted to elaborate
why I do this and how this makes sense for me (and most probably for you too!).
# Collection
Running find -type f | grep -v 'awk' | wc -l
inside my ~/bin
returns 304
.
What do I need 300 shell scripts for you might ask? Well, let’s dive right in.
# The unix way
Within the last 10 years or so of my usage with Linux
I’ve created a ton of
utilities that I use daily, weekly or less. But that does not mean these scripts are useless.
I try to automate things when one or more of the following things are true:
- These tasks are mundane and often
- These tasks are important
- These tasks are time-eating
- These tasks are easy to get wrong
- These tasks need to be run periodically
- These tasks are in a chain of other events/tasks
- (… and so on)
I give you a few examples:
mksh
: Stands forMake Shell Script
and creates a simple shell script at the target location and opens it in an editorblog
: My blog generator. Just around 50LOC but generates the pages, writes an atom feed and an index page.emoji
: Translates text like:-)
to the appropiate emoji in my current icon fontslug
: Create a slug from an input textarnf
: Automatically renames a file to it’s slug (see above)lstf
: A find wrapper that is more convinientimgc
: Usesrawtherapee-cli
to automatically extract exif information of the camera and the used lense to apply retouch filters (also respects ISO)aimd
: A script to automatically handle image workflows:- Moves images in the right directory (Retouched, Converted, Old)
- Converts images using
imgc
- Finds files using
lstf
cmlg
: Finds all shell scripts and prints their short description in a listfart
: Probably my favorite script.F
etchesA
lbum Art
for local music
# 4 letters
I recognized you are using 4 letters for script names only?
Yes, very good observation! When possible, I try to use 4-5 letters for my script name.
Because I don’t feel like typing rawtherapee-cli
again and again and creating an alias defeats the purpose of having a long name in the first place.
This is also way easier (at least for me) to understand:
lstf | xargs -L1 arnf
(This lists all files in current directory and converts their names, if not done already)
# Workflows
Currently I have a few workflows that I manage periodically:
- Scan a document and automatically convert it to PDF (with searchable text) using tesseract and name the document accordingly. (like topic-person-date.pdf)
- Import images from my camera, move them accordingly convert them, run filters and create a gallery
- Handle new music and transcode it, fetch art if missing
- Create (network) backups regulary on all computers on my NAS and sync it daily to my cloud storage space
- Convert my daily appointments to a format that my desktop alert manager understands and feed it into said program
- (that’s all from the top of my head)
# More to come
This is just the first post of my new series. There are a lot of things I could (and want!) to write about, so the next posts will probably dig a bit deeper into my workflow.
Comments (disabled for now)