linux

Configure Keyboard Layout Switching for Sway

A US keyboard layout increases my productivity as a developer, because characters like square brackets, pipe and backslash are easier to type than on a German keyboard. For the occasional German special character I like to use the AltGr key, preferably with the keys where they are already printed on my physical keyboard. From time to time I need to write longer German texts that don’t need a lot of special characters and need Umlauts instead.

Creating users and their passwords with Ansible

This article will teach you how create user accounts with the configuration management software Ansible. You will learn how to create users with passwords, SSH-only users and users with temporary passwords that must be changed. Some background on passwords on Linux The file /etc/passwd hints at passwords, but stores only an “x” or other character where the password has been stored historically. The real passwords are stored in the file /etc/shadow, in a hashed format.

Using grep on files with no newlines

I had a big, automatically-generated HTML file without newlines and wanted to see all occurrences of a certain image name. Using the command grep my_image.png just outputs the whole file - not useful! While writing the question to the unix section of StackExchange, I found a way to do it with grep: grep -oE ".{30}my_image.{30}" This command yielded the desired result: Each occurrence on a separate line, with 30 characters before and after.