Base64 encode on shell

Sometimes you need to encode a string  with a base64 encoding. For example when trying to send a HTTP request with a Basic Authentication header like that:

As you can see the Basic Auth username and password are included in the request as a base64 encoded string. On the Linux shell this string can […]

Wipe a disk via Linux shell

This is how to wipe a disk via Linux shell:

The command above erases all data on the device /dev/sdc and overrides the data 2 times. Finally every bit is overridden by zeros. So in sum it takes 3 iterations to wipe a disk via Linux shell. n specifies the number of iterations taken place […]

Setup monit behind Apache proxy under ISPConfig

Today I wanted to setup monit behind Apache proxy on my webserver, which runs ISPConfig (https://www.ispconfig.org/) under Debian. Monit is a OpenSource monitoring tool for Linux (see https://mmonit.com/monit/). Requirements I had the following requirements on the solution: monit should only be accessible from the server itself (localhost) monit should run under a special SSL-secured URL (not IP:PORT as […]

Mount ISO file under Ubuntu Linux

Today I had the challenge, that I wanted to copy a DVD and  play it with the VLC media player (http://www.videolan.org/vlc/index.html). Therefore I had to learn how to mount iso file(s) under Linux. In my case it was Ubuntu 16.04.1. (see also my article about how to get your Linux distribution and version). How to […]

Count search results on Linux shell

Lets imagine you want to search for a term in a file and you want to know, how often it can be found in the file. With this command combination you can count search results on bash:

This is how this way to count search results works: The input file is opened in less. Afterwards […]

Convert linefeeds for all files in a folder (CRLF to LF)

If you are working in teams using different operating systems, it could happen, that you get files with unsuitable linefeeds in it. For me as a Linux user the bad guys are normally CRLF’s (Carriage Return and Line Feed @see https://en.wikipedia.org/wiki/Newline). To just convert the CRLF’s in a single file to LF you can use the […]

Simple rsync based backup script

This simple bash script is able to backup all given files and folders to a backup destination. I use it to backup all my Raspberry Pis, Banana Pis and also my notebook to my Synology NAS.

Example call:

If you want to run it as a crontab, you can use key based authentication (see […]

Recover lost images from SD/MMC cards

A very nice and really working recovery tool is  PhotoRec. It’s a very cool commandline tool for Linux which is able to recover all images on a SD or MMC card that have been deleted accidentally. In my case my fingers where faster than my brain and so I had kicked three rally awesome images :-/. […]

Send a mail over a linux shell

Installation:

Send messages using the mail-command To check If  postfix is installed and ready to work on your system, you can try:

Reconfiguration of postfix on Debian / Ubuntu:

Alternative sendmail