Make: don't print command-line with @

TIL: in a Makefile command, use @ as a prefix to avoid printing the command line as it is executed

May 26, 2022 · Fernando Costa Bertoldi

Change locale of man pages

TIL: use the flag -L to read the manpages with a different locale: man -L en_us nmap Alternative: set the LC_ALL env variable as part of the command https://unix.stackexchange.com/a/87763/79225 # LC_ALL is the environment variable that overrides all the other localisation settings # The C locale is a special locale that is meant to be the simplest locale. LC_ALL=C man 2 select

May 12, 2022 · Fernando Costa Bertoldi

Print the absolute path of a file with realpath

TIL: use realpath to print the absolute path of a file. Useful for creating symlinks. for f in $(realpath scripts/linux/*); do ln -s "$f" ~/bin/$(basename "$f"); done

May 7, 2022 · Fernando Costa Bertoldi

whitespace-mode

TIL: use whitespace-mode from emacs to check trailing whitespace in files. Useful in some situations, i.e. in shell scripts to guarantee that line continuation (backslash) don’t have trailing whitespace, which is a problem.

April 12, 2022 · Fernando Costa Bertoldi

Shellcheck

Used shellcheck, a shell linter, very useful.

April 12, 2022 · Fernando Costa Bertoldi

Pretty-print tabular output with column

TIL: pipe output of commands that are tabular to the column command to make them more readable

April 6, 2022 · Fernando Costa Bertoldi

Resolve the path os symlinks with readlink

TIL: use the readlink command to resolve symbolic links to executables. Use the -f option to follow the link recursively. # find the path to the youtube-dl script. readlink -f $(which yt-dlp)

April 6, 2022 · Fernando Costa Bertoldi

Google Sheets: =ISBLANK("") -> FALSE

The Google Sheet function ISBLANK() goes against all that is right and holy, and evaluates the empty string as non-blank.

Fernando Costa Bertoldi

: (colon) on bash

https://stackoverflow.com/questions/3224878/what-is-the-purpose-of-the-colon-gnu-bash-builtin https://unix.stackexchange.com/questions/31673/what-purpose-does-the-colon-builtin-serve Historically, Bourne shells didn’t have true or false as built-i commands. true was simply aliased to : : is slightly better than true for portability. Uses: # alias to true while : ; do command ; done # variable expansion, assign default value var= : ${var:=DEFAULT} echo $var DEFAULT

Fernando Costa Bertoldi

APT: apt purge <package>

TIL: purge is identical to remove, but it also deletes configuration files

Fernando Costa Bertoldi