Converting SVG to PNG

SVG diagrams are vector-based graphics. This post shows how to convert them to a pixel-based picture format, like PNG, in the command line.

For this, the rsvg-lib is needed. It can be easily installed with common package managers. On macOS, this can be done with: brew install rsvg-lib

After installation, you convert SVG files with: rsvg-convert -h [pixel height] in.svg > out.png Since SVG has no fix resolution, a pixel dimension must be specified.

Useful PowerShell Commands

PowerShell is a powerful command-line shell from Microsoft. Originally released as a more capable alternative to the Windows-native Command Prompt, it is currently available on all major platforms.

These are my favorit and frequently commands:

  • ii [path to folder] opens the specified folder in the Windows Explorer

  • measure-command { [command] } measures the execution duration of the specified command

  • query user lists logged-in users

  • get-content [file] shows contents of specified file

  • get-alias [command] shows alias for specified command

  • get-process [application] shows process ID

  • new-item -type file [file path] creates an empty text file to the specified path

  • echo $env:[variable] shows contents of specified environment variables

  • [command] *>$null surpresses PowerShell output

  • update-help updates help files. You have to do this as administrator.

Using Wake on LAN on Linux

Most PCs support Wake On LAN (WOL). In fact, the built-in ethernet adapter supports this feature. It allows to put a machine in sleep or hibernate mode and to wake it up remotely from the same network. After the machine wakes up, logging in by using SSH is possible.

Follow these steps on the machine you want to support WOL:

  1. ifconfig displays all network devices

  2. ethtool [network device] displays the qualities and settings of a network device. Here you can see if your ehternet adapter supports WOL.

  3. ethtool -s [network device] wol g: this command turns on WOL in case it is supported, but not activated yet

Finally use this command from another PC to wake up the machine: ether-wake -i [network device] [MAC address]

The ether-wake commands works among others on the RHEL distribution. On some other Linux distributions, the command can be slightly different. Alternative commands are wol or wakeonlan.

Mounting External Drives on Linux

Like on Windows and macOS, on most modern graphical desktop environments on Linux connecting an external hard drive is pretty much plug & play. This feature is called auto-mount and is an autmaticaly run procedure mounting an external drive to the system.

In case you want to mount a drive manually, follow these steps:

  1. lsblk for displaying all connected hard drives. You need to remember under which device path the connected drive appears, e.g. /dev/sdb.

  2. mkdir /media/[mount directory] creates an empty folder which will be the mounting point where you will be able to access the drive’s content. Creating this folder in /media is just a convention on some distributions.

  3. mount [device path e.g. /dev/sdb] [mount directory e.g. /media/usb-stick] finnaly mounts the device on the previously created folder.

Using tmux

tmux is a so called terminal multiplexer which lets you open multiple terminals side-by-side. This allows to switch between programs on the same terminal, and to work with different files simultaneously.

These are the most important commands:

  • Split screen vertically: Ctrl+b %

  • Split screen horizontally: Ctrl+b "

  • Switch between screens: Ctrl+b o

  • Create new windows: Ctrl+b c

  • Switch between windows (forward): Ctrl+b n

  • Switch between windows (back): Ctrl+b p

  • List all commands: Ctrl+b ?