Show WiFi signal strength in command line on Mac

while x=1; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep CtlRSSI; sleep 0.5; done


Add prefix to files

Rename all files in the directory, adding prefix "test" to them:

rename 's/^/test_/' *

Mounting a directory in a directory

You can mount a directory inside another directory. It is a functional analogue of having it hard linked, which is normally available only for files.

You can do it either by running a command:

  • mount --bind source_dir destination_dir

or, if you want it to be permanent, adding a line to your /etc/fstab:

  • source_dir   destination_dir   none   defaults,bind   0   0

Fix charset in Midnight Commander

If you see strange characters in mc, with all the line art ruined, run the following command in the terminal, before starting mc:

  • export LANG=en_US.ISO-8859-1

Canon LiDE20 not working

So you have a new computer with those blue USB3 ports and are using probably Linux Mint 17.3 Mate, Ubuntu 14.04 or similar OS.

The Canon LiDE20 scanner which used to work with your older computer, refuses to scan now.

If you enter “scanimage -L”, you get output shown here below, followed by a long wait:

  • device `plustek:libusb:002:003′ is a Canon CanoScan N670U/N676U/LiDE20 flatbed scanner

The problem is related to the fact that your system has USB3 ports.

One way to solve the problem is to go to BIOS setup of your computer and look for USB ports related options.

With my ASUS motherboard I fixed it like this:

  1. F2 or Del at boot for BIOS setup
  2. Advanced Mode (F7)
  3. Advanced:
  4. USB Configuration:
  5. Intel xHCI Mode -> change from Smart Auto to Disabled


Screen tearing in Linux Mint

Pronounced screen tearing with Linux Mint 17.3 Mate (inherited from Ubuntu 14.04).

Solution is extremely easy.

Create the following file:

  • /etc/X11/xorg.conf.d/20-intel.conf

And enter the following content:

Section "Device"
   Identifier  "Intel Graphics"
   Driver      "intel"
   Option      "TearFree"    "true"

Get the 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 every new post delivered to your Inbox.