Cli
21 Apr 2025
List active network interfaces with addresses
25 Mar 2025
Set Linux XDG Default App To A Flatpak
The one where we set the default system web browser to LibreWolf installed as a Flatpak
3 Mar 2025
Install *timewarrior-dataframe* using *pipx* for pivot tables of *timewarrior* summaries
Things to know:
- Timewarrior (
timew) is a command line tool for tracking time. - Timewarrior-Dataframe is an extension processes
timew exportoutput using the Pandas Python module.
Install #
Timewarrior can be installed on recent Ubuntu releases from the apt repositories. It can also be found in a number of other distro’s packaging systems.
# Ubuntu (and/or Debian?)
sudo apt install timewarrior
pipx can be used to install the timewarrior-dataframe’s twdf command from it’s git repository.
5 Sep 2024
"teethis" script is one of the most useful tools I've created
tee is a GNU tool to piggy back stout off of a pipe. The following example shows the basic pattern for using it, where the stout is printed to the terminal and written to a log file.
mycommand | tee mycommand.log
“teethis” script #
I frequently want to run shell scripts where I can see both the stdout and stderr immediately while preserving the output to refer to later. While the tee command to do this is relatively simple, it can be a pain to type over and over again, so I created the following teethis script.
27 Aug 2024
`apropos` is an overlooked Linux command
Search for Linux command that does what you need #
Sometimes the challenge of using the Linux command line is knowing what commands you need to do certain things.
The apropos command lets you search the available commands by matching key words.
❯ apropos csv
# bench_wcsv (3tcl) - bench::out::csv - Formatting benchmark results as CSV
# csv (3tcl) - Procedures to handle CSV data.
# csv2rec (1) - csv to rec converter
# rec2csv (1) - rec to csv converter
❯ apropos environment
# 0desktop (1) - add programs to the desktop environment
# 30-systemd-environment-d-generator (8) - Load variables specified by environment.d
# byobu-janitor (1) - script for cleaning and upgrading environment after upgrades
# byobu-reconnect-sockets (1) - Sourcable script that updates GPG_AGENT_INFO and DBUS_SESSION_BUS_ADDRESS in the environment
# check-language-support (1) - returns the list of missing packages in order to provide a complete language environment
# clearenv (3) - clear the environment
# dbus-update-activation-environment (1) - update environment used for D-Bus session services
# Dpkg::Build::Env (3perl) - track build environment
# env (1) - run a program in a modified environment
# environ (7) - user environment
# pam_env.conf (5) - the environment variables config files
# ...
The command checks all of the installed man pages and package descriptions, however there are circumstances where this could leave out some relevant commands.
27 Nov 2023
Manually customize bash terminal prompt look
The prompt text that bash interprets and uses is set with the PS1 environment variable and is usually specified in ~/.bashrc. I have been manually tweaking my bash prompt look and feel to make some of my work project use-case tasks easier. The combination of default style changes, and specific prompt elements added for active environment or sourced environments should make terminal-based project management a little easier.
A little searching allowed me to discover this website that allows you to interactively customize the prompt contents and style with common components. https://bash-prompt-generator.org/
17 Nov 2023
Automatically backup optical discs on linux
Here is a short starting-point for developing a bash script that can be used to automate optical disc ripping. At least for music and application CDs as well as DVDs. Some other cli commands will need to be added to deal with bluerays or other formats.
abcde to rip CD music #
abcde is used to rip music CDs to various formats (my configuration is set to FLAC to preserve the raw quality but in a compressed format to save space.) This command will fail for DVDs.
3 Nov 2023
Installation #
notify-send
# Command 'notify-send' not found, but can be installed with:
Installation with apt
#
# debian/ubuntu
sudo apt install libnotify-bin
Installation with dnf
#
# redhat/fedora
sudo dnf install libnotify
Usage #
notify-send "this is the summary"
notify-send "this is the summary" "this is the body of the notification"
Send to remote machine over SSH #
ssh user@host 'DISPLAY=:0 notify-send "TEST MESSAGE."'
Styling with HTML #
HTML tags are supported for styling the notification messages, even including images, although the result is not styled in the case of notifications in the rofication setup used by default in the i3wm-based regolith-desktop DE.
11 Oct 2023
*ugrid* ADCIRC vectors in QGIS with MDAL
use nco cli to make compliant files
15 Dec 2022
`diff` Also Compares Directories
Short post so that I can remember this everytime I need to do something similar!
Using diff on more than individual files
#
The quick and dirty explaination is that the GNU/Linux diff command has an -r flag to recursively compare two folders. The command help indicates that it is shorthand for the full --recursive flag, which might be easier to remember.
diff --help
# ...
-r, --recursive recursively compare any subdirectories found
# ...
Example #
In the following example, “Only in” shows that particular files are only found in one of the folders. By default, matching files are not shown. If a file can be found in both folders and the two versions differ, the normal diff output is provided along with the modified times. All together these details provide a good summary of what a user might want to know when comparing two directories.
24 Mar 2022
Bad Hacks to Find Linux Drive Device from UUID
On linux, you can’t count on the devices listed under /dev/sd* or /dev/xvd*, to have the same names or order. With the UUID (which is how /etc/fstab usually specifies how to mount the root system device), the /dev device name can be determined using the blkid command and some hacky bash.
# For a system that uses /dev/sda, etc. use 0:8 string slice for blkid
MYDEVICE=$(blkid | grep ${MYUUID}) ; echo ${MYDEVICE:0:8} # /dev/sdc
However, you might need to do something like start a Docker container with your main system device connected using docker run --device=..., and so the following also works in this specific case looking for the device mounted at the local machine’s /.
16 Nov 2020
If you have ever had a need to move the output of a Linux console command to your clipboard, xclip is the solution!
To copy a file’s contents to the standard “ctl+c/v” clipboard buffer issue you can following this command:
xclip -sel clip your-file-path
The most useful feature is reading from a stdin pipe:
head my-file-path | xclip -sel clip
…and then your ready to paste into an email or Slack chat.
1 Jan 0001
A collection of bash/zsh/etc. shell functions and aliases
1 Jan 0001
If you find you are using commands like sleep to run a one-off task at a specific time, then meet the GNU at command.
at will allow you to specify a time to run a specific command, and accepts a wide range of different formats including “now + 4 hours”, “noon”, and “next tuesday”. The command will read commands from stdin or using the -f to specifiy a file to be executed using the default /bin/sh.