Get first n characters of a string

How to get few characters from beginning of a string in bash?

In this example the first 21 characters of all files in the directory are echoed on the screen:

  • for i in *; do echo ${i:0:21}; done

Get sha1sum checksum only

The sha1sum utility returns not only SHA-1 checksum, but also the name of the file it was called for. There is no option to disable this.

To discard the file name and keep only the checksum for file /etc/fstab:

  • sha1sum /etc/fstab | sed 's/ .*//'

Replace soft link with the original file

So you have a directory which contains soft aka symbolic links or symlinks. You want them gone, replaced with the actual files they are pointing to.

This one-liner will do the job:

  • for i in $(find . -maxdepth 1 -type l); do cp --remove-destination $(readlink $i) $i; done

Choose monitor output in Mate

You may experience after installation of Linus Mint Mate having a screen which shows you only the desktop wallpaper, but no icons and no menu. Though when right-clicking your mouse, you can call up the standard context menu.

The reason for this is not clear, but whatever it is, the situation is caused by your Linux system generating image for two screens and the “active” end of the desktop being drawn on the other, invisible screen, not the one which you are actually using. This may happen, for example, if you have both VGA and HDMI outputs.

user@user-All-Series ~ $ mate-control-center

Simply right-click the desktop and select “Open in Terminal”, or, alternatively, press Alt+F2 and enter:


Then, already in the Terminal, type:


Once in the Control Center, select Displays and either just put check mark in “Same image in all monitors” or configure the displays with On/Off and “Set as the primary” options.

Losslessly rotate JPEG image

Use exiftran to losslessly rotate JPEG images. It preserves EXIF data while doing it. And it can even auto-rotate your images in accordance to the EXIF rotation data.

Example to losslessly autorotate all JPEG images in the current directory:

  • exiftran -ai *.jpg*

Making Gantt charts in Excel

A tutorial on how to make make a Gantt chart in Excel by using standard graphing tools.

Other sources:

Start page for Chome

Speed Dial 2, an extension for Chrome browser, giving you a start page you can add your favorite links to. You can look for it at the Chrome Web Store too.


Get every new post delivered to your Inbox.