Linux: Quick 'n Dirty Geekery

Change the system time and date to what YOU want:

Whah dadnabbit, just let me control my own computer thank you.

1) Shut the net-time-synchronisation the !#@&! up
2) Set time as you see fit
3) Set date as you see fit

timedatectl list-timezones
sudo timedatectl set-timezone Africa/Windhoek
sudo timedatectl set-ntp 0
date +%t -s "21:14:00"
date +%Y%m%d -s "20120422"

Change all occurrences of some extension:

rename "s/MOV/movtmp/" *.MOV

The above command finds all .MOV files in the current directory and changes the extension to .movtmp, and...

rename "s/movtmp/mov/" *.movtmp

... takes all the files just renamed and changes them to the .mov extension. These two together have thus changed the uppercase MOV to lowercase mov

Google Earth Error: Won't display clamped polygons

Use this workaround to display transparent polygons in an almost acceptable way:

LIBGL_ALWAYS_SOFTWARE=1 /opt/google/earth/free/google-earth %f

Scan servers on network

Perform host discovery thusly:

nmap -sn 192.168.2.1/24
 
 
 
    
 

Create a favicon.ico

sudo apt-get install netpbm

Edit an image file in GIMP and save it as a 16x16 pixel .pnm file (raw).

Convert the pnm file to .ico:

ppmtowinicon -output favicon.ico favicon.pnm

 

Using rsync for backups

sudo apt-get install rsync
rsync -vrh source destination
rsync -ahvz /important/stuff usr@192.168.42.42:/backups/   

rsync will create the destination directory if it does not exist.
If your remote host uses a non-standard port number, i.e., other than 22, use this:

rsync -ahvz -e "ssh -p $non_standard_port_number" usr@10.0.0.74:/backups/ /important_stuff/

Options:

  • -a : archive mode. Copies files recursively, preserving symbolic links, permissions, user + group ownerships, date + timestamps
  • -h : output in human-readable format
  • -r : copies files recursively
  • -v : verbose
  • -z : compress data

Overview of available wireless networks with channel no., signal strength and quality:

Tested on Ubuntu 15.05 (example output below) and Raspian.

iwlist wlan0 scan | grep 'ESSID\|Quality\|Frequency'

Display progress of dd command:

watch -n10 'sudo kill -USR1 $(pgrep ^dd)'

Hibernate laptop when closing lid:

Tried and tested on Ubuntu Vivid 15.04

sudo vi /etc/systemd/logind.conf

...and add a line like this...

HandleLidSwitch=hibernate 

Migrate Chromium and Firefox settings

Chromium: put contents of Chromium's folder to the same place on the other machine:

cp ~/.config/Chromium/ /same-place-on-other-machine/

Firefox: put contents og folder (e.g. bLah1321) into folder (e.g fRogmz56) on other machine:

cp ~/.mozilla/firefox/bLah1321/* /same-place-on-other-machine/fRogmz56/

(more quickness and dirtyness to be added)

Fatal error: Cannot redeclare views_views_plugins() (previously declared in /home/u364906667/public_html/includes/sites/all/modules/views/includes/plugins.inc:15) in /home/u364906667/public_html/sites/all/modules/views/includes/plugins.inc on line 15

Fatal error: Cannot redeclare views_views_plugins() (previously declared in /home/u364906667/public_html/includes/sites/all/modules/views/includes/plugins.inc:15) in /home/u364906667/public_html/sites/all/modules/views/includes/plugins.inc on line 15

Fatal error: Cannot redeclare views_views_plugins() (previously declared in /home/u364906667/public_html/includes/sites/all/modules/views/includes/plugins.inc:15) in /home/u364906667/public_html/sites/all/modules/views/includes/plugins.inc on line 15

Fatal error: Cannot redeclare views_views_plugins() (previously declared in /home/u364906667/public_html/includes/sites/all/modules/views/includes/plugins.inc:15) in /home/u364906667/public_html/sites/all/modules/views/includes/plugins.inc on line 15

Fatal error: Cannot redeclare views_views_plugins() (previously declared in /home/u364906667/public_html/includes/sites/all/modules/views/includes/plugins.inc:15) in /home/u364906667/public_html/sites/all/modules/views/includes/plugins.inc on line 15