EINVAL: Valid solutions for invalid problems

Emacs as a Shell

, updated on

When I log into a new server, one of the first things I do is install a minimal Emacs package1. Of course assuming nobody minds if the server is not strictly mine, I’m not a monster. Emacs serves me as a de facto shell when setting up whatever there is to set up. By “shell” I mean a broader meaning of this word than just a command prompt: it’s the central program I use to interact with the system.

less can do even more

After writing my last post I took my own advice and reread the less(1) manpage. Surprisingly I found some new really handy tricks that were very helpful not even an hour later! First of all, the pair matching. If the topmost displayed line (that’s the important part!) contains an opening bracket {, we can press this very key to find the matching closing bracket (}). It is displayed by placing the line with the matching } at the bottom.

less can do more

less is probably one of the most used programs in the UNIX world. It’s so ubiquitous we usually barely notice it. For clarity, I mean this less, not this one. Despite its ubiquity, very few people actually take time to learn its less obvious but still very useful features. Let’s change that! First of all, the & key. It prompts for a search pattern and then acts like a filter, showing only the matching lines, not unlike grep.

Secondary login credentials

Sometimes I need to access my files on my servers using SSH/SCP from an untrusted device and/or application. Usually I would create a new SSH key pair so that I can easily revoke these credentials later if such need arises. But what if the used application doesn’t support SSH keys or we do not want to use them for some reason? There is a trick supposedly used by sysadmins in the olden days, before sudo was around.