Terminal

I've come to appreciate the terminal. See what hackers use on the movie? Yes, that's what I'm refering to.

It looks indeed horrifying. No hand-holding. Unconventional to GUI. Cryptic commands. Hacker's feeling. They can be reasons why people are afraid of it.

Little did they know, how powerful it is.

Automation

The terminal allows us to access to the shell, the thin interface between the OS and us. This means, you can interact with your OS in a more efficient way than any GUI can do. The shell script, a small program which uses shell syntax and OS utilities, is powerful, designed to solve small, specific problem.

For instance, here is the script I use to create a new page for blogging:

#!/bin/sh
# new-page.sh

set -eu

DEFAULT_POST="source/posts"

help="\
Usage: $(basename "$0") TITLE [PATH]

Positional argument:
    TITLE   Title of the page

Optional argument:
    PATH    Folder to store new page (default: $DEFAULT_POST)
"

if [ $# -eq 0 ]; then
    printf "%s\n" "$help"
    exit 0
fi

title="$1"
path="${2:-"$DEFAULT_POST"}"
date="$(date +%Y-%m-%d)"

title_url="$(echo "$title" |\
             sed -E "s/[^a-zA-Z0-9 -]//g; s/ +/-/g" |\
             tr "[:upper:]" "[:lower:]")"

dest="$path/$title_url"

front_matter="\
<h1>$title</h1>
<time datetime=\"$date\">$date</time>"

mkdir -p "$dest"

printf "%s\n\n" "$front_matter" > "$dest/index.html"

printf "Created new page %s\n" "$dest/index.html"

It will take two command-line arguments as title and path (path is optional and default to source/posts for convenience). Then it will format the title so it is URL-friendly. A front matter (lines of code which define the post) is predefined, which will be copied into created HTML file.

I love this. A new post is just sh new-page.sh "Example Title" away. No need to goes through the setup progress, as the script already does it for me. Time saved, satisfaction increased.

The syntax is confusing, I know. But, considering how powerful it is, it is worth the effort.

And that's not the end of the story.

Minimalism

You may have guessed from the website layout that I like minimalism. It helped me to communicate ideas and live without being constrained by fancy appearance.

Terminal is minimal. It's unappealing. It does not bombard you with call-to-actions. It sits there, waiting to be utilized. A mean to an end.

And it brings me joy. The joy to focus.

And Unix further amplifies this minimalism by its philosophy. A match made in heaven.

The beauty is there.

You should use it

Open your Windows Terminal, your Konsole, your iTerm2. Learn how to perform operations like listing files in current directory, moving/copying files around, and create a new file. Learn the shell syntax, and try to write a small script. Learn command-line tools.

The pain of unfamilarity is there. But, after some times, you will come to appreciate it.

I come back to (Neo)Vim because of these. Combining with some small plugins, I can comfortably live with the terminal. A relief from VSCode.

See you.