The `xrandr` utility can be used to configure outputs for X11 from the command line. For example, you can use it to configure and inspect resolution, position (relative to other monitors), rotation, scaling, refresh rate, DPI, and much more. It can even apply geometric transformations.

As an example, since I don't use a desktop environment, I have a script that detects when I connect/disconnect my laptop to/from its dock, and applies the appropriate monitor configuration.

`setxkbmap` can be used to modify the keyboard layout under X11. For example, I use `setxkbmap -option ctrl:nocaps` to bind capslock to ctrl, to cut my pinky and wrist some slack.

Some people bind capslock to escape (e.g. `-option caps:escape`) because that's the keyboard layout under which vi was developed. I don't bother, because ^[ is equivalent to escape in a terminal, so I get more utility out of having ctrl:nocaps.

(See `man xkeyboard-config` if your system has it.)

My 9 and nearly-7yo sons enjoyed following along with what I thought would be a tedious tutorial on 2D sprite cutout animation and skeletons. They're too young to understand the language in them, letalone fully understand it (and the necessary prior knowledge), but they were getting a hang of it and having a blast. Turns out, tedious was good as rote practice.

They've drawn their own characters, so I wanted them to see how they'll have to draw individual components.

A couple useful debugging commands for X11:

`xeyes` will render two eyeballs that follow your mouse cursor. Though I've used it more for entertainment, testing X11 forwarding, and testing configs with `startx`.

`xev` outputs useful information about X11 events, including keypresses and mouse movements. It's useful for discovering the names/codes of keys for keybindings. And running it can even help you recover if some program has captured X11 input and hasn't released it.

I've mentioned GnuPG support in Emacs a number of times for encrypting documents. But it can also be used standalone via the `gpg` command.

My first contribution to GNU Guix was to get pcscd and scdaemon working with GPG, allowing me to use my Nitrokey (a USB smartcard). Those daemons typically run in the background and you don't have to worry about them.

gpg-agent can also double as an SSH agent, so you can use your smartcard in place of an SSH key on your filesystem.

When running commands that access the Internet, you can prefix the command with `torsocks` to run it through a running Tor instance. You can also use `tor-resolve` to resolve DNS over Tor.

But be careful how you share that Tor connection with other programs/activities, since certain commands could expose data or patterns that deanonymize you.

Useful command, but know your threat model, and know your tools.

Outside of Mastodon, I communicate with others almost exclusively via email; many days, I live in it. Since my MUA (Gnus) is integrated into my editor (Emacs), and my mail is in plain text, it's easy for me to manipulate.

It therefore makes sense for me to use it as a means of aggregating data.

One such example is RSS: I use r2e (rss2email) to gather RSS feeds and convert them to email, which is then sent to my local Dovecot server. I can then read them comfortably, offline.

How I handle my email:

I run a Dovecot server on my home network (inaccessible externally) that I connect to via Gnus. I use fetchmail to pull mail from my personal mailserver (mikegerwitz.com, also running Dovecot), and fencepost.gnu.org.

Mail rules are assigned on mikegerwitz.com if it needs to bounce, via Sieve. Otherwise, I have Sieve rules on my internal mailserver.

My SMTP server at mikegerwitz.com is Postfix. The SMTP server I use depends on my From address.

I use BBDB (Big Brother Database) with Gnus. This creepy-sounding package stores information about contacts. For example, I'll store their mail aliases; IRC handles; software they maintain (especially within GNU); organizations they're a part of; desired gender pronouns; country/state; and other non-sensitive data.

Importantly, though, I want to respect the privacy of individuals, so I added a `.gpg` suffix to my bbdb file so that Emacs encrypts it (using my Nitrokey).

My MUA (email client) is Gnus, which runs under Emacs. I migrated to it from Mutt many years ago because of the level of flexibility it offers.

It also has integration with other important packages. For example, cross-references can be stored using Org mode, which I use frequently in my notes to reference messages and threads.

I've gathered nearly 1 million messages (I subscribe to many lists) over the years, and get many 100s a day, and it manages them well.

One of the original reasons I adopted Emacs (after evil-mode was created) was Org mode.

I use it for time tracking; agendas; note taking and organization; recording and graphing of data; preparing, rehearsing, and rendering slides for talks; cross-references to emails (Gnus integration); literate programming; my emacs config; project planning; Kanban; and much more.

Add .gpg to the file and have your notes automatically encrypted by Emacs.

orgmode.org/

I primarily use GNU Emacs as my editor, but I've been using Vim for much longer (~15y). I find the keybindings of Vim to be superior for text editing (and so use evil-mode in Emacs), though I will mix Emacs keybindings in when they are more appropriate. I tend to use Vim for quick edits, or when I use heavy macros on large files.

But Emacs is so much more than a text editor, and I use it for many things. That will be the subject of a number of future posts.

The commands `kill` and `pkill` are useful for more than just killing processes---they can send many different signals (see `kill -l`).

For example, I have `pkill -STOP icecat` and `pkill -CONT icecat` as i3 keybindings to pause and resume IceCat (a Firefox derivative), since most of the time I'm just working out of a terminal and don't need wasted battery. (Despite allowing JS only on my self-hosted Mastodon instance, it still uses more CPU than I'd like it to.)

For interacting with the clipboard on GNU/Linux, I use xsel and xclip. The former is more concise, but the latter provides some useful features.

For example, `xsel` to read primary, `xsel -b` for what most users know as the clipboard, `-i` for writing. `xsel | xsel -ib` to copy from primary to clipboard.

`xclip -l 1 -quiet` to block until one paste. Useful to e.g. pipe a password from a password manager so that it gone after you paste it, or to chain pastes (user then pass).

For playing video, I use `mpv` (successor to mplayer). It also supports URLs, notably YouTube (if you have `youtube-dl` installed), allowing you to play videos without having to run non-free JavaScript.

If you prefer a GUI, VLC is a good media player which also supports playing YouTube videos.

For tasks that need to happen at a certain date or time in the future, there's the `at` command. For example, I just received an email from myself reminding me that my GPG key is set to expire soon.

You can view your queue with `atq`, and remove them with `atrm`.

If you need to schedule tasks to happen more than once, see `crontab -e`.

Want to render plain text in a more interesting (or obnoxious) way? `cowsay` and `figlet` offer good fun.

Bonus points if you can actually use them in a context that is productive and useful. You've almost certainly seen figlet's output before in a number of different contexts, such as motds and headings.

I work mostly from the command line, but sometimes I need to open an external GUI program to do something visual.

Since I don't often use those programs, I may forget what I installed to open a particular file.

The command `xdg-open` from xdg-utils will try to DTRT and invoke the right program for you. You can query and change preferred programs using `xdg-mime`. And this works without a desktop environment (e.g. I use i3wm).

My last post on free software I use mentioned a substitute for using search engines for word definitions.

Another common use of search engines is unit conversions (e.g. 3 miles to km). For that and more, I use GNU units (gnu.org/software/units/).

I can't do any justice to this program with the number of characters I have left, so please, check it out; you won't be disappointed.

One of my favorite command line tools is `dict`---a dictionary and thesaurus. I use it multiple times a week. If you find yourself prefixing search queries with `define:`, this tool is for you.

If you install `dictd`, you also get the freedom and privacy of answering your own queries on a system you control, without the need for Internet access.

Show more
Mike Gerwitz's Mastodon Instance

Mike Gerwitz's personal Mastodon instance