Home
Send email
Tune your guitar differently
A logical piano keyboard
The magic piano is here at last!
Leverage locate tools
Letters and figures : a Countdown type game implementation
Some tips for Linux on command line
Tiny green thoughts
Photographs from the Alps and elsewhere
III blog
Retrouvez-moi sur Facebook
Retrouvez-moi sur Twitter

Migo's Linux tips on command line

Updated January 29, 2023


Here are some tips to spare your time, eye strain and wrist ache by doing things in batch mode rather than pointing and clicking like a 3 weeks old rabbit before he lost his spectacles.


Using GPG to password encrypt your personal files


Have a self-updating photo album with ImageMagick and PHP


Using DAR for your backups


Poll several mailboxes


Poor man’s play list


Auxiliary bash functions


Using GPG to password encrypt your personal files


Type 'gpg --version' on the command line to check if you have GnuPG installed on your system. If you only get a message similar to:

bash: gpg: command not found
then you may click here to download GnuPG - The GNU Privacy Guard.

Encode script

Usage: gpgenc [-rhv] [-p password] [entryfile1] [entryfile2...]
 -k                 use asymetric coding to self
 -p password        give password on command line
 -r                 recurse into subdirs
 -l                 log password in system log - use with extreme care
 -v                 verbose, more comments displayed
 -h                 this help

 Encodes files and directories given as arguments using gpg symetric encoding.
 Files to encode must not begin with _
 A '_' character is prepended to the encoded file's name.
 Without args, encodes all non crypted files in current directory.

Decode script

Usage: gpgdec [-rlshv] [-p password] [entryfile1] [entryfile2...]
 -p password        give password on command line
 -r                 recurse into subdirs
 -l                 log password in system log - use with extreme care
 -s                 success : return at first failed decoding
 -v                 verbose, more comments displayed
 -h                 this help
 Decodes files and directories given as arguments using gpg symetric decoding.
 Encoded files must begin with _
 The initial '_' character is trimmed from the encoded file's name.
 Without args, decodes all crypted files in current directory.

Have a self-updating photo album with ImageMagick and PHP


If you have a web page were you display and share photographs, you don't need to bother editing it. PHP and ImageMagick will do that for you.

Type 'mogrify -version' on the command line to check if you have ImageMagick installed on your system. If you only get a message similar to:

bash: mogrify: command not found
then you should click here to download ImageMagick in order to convert, edit, and compose images.

Safely scale your pictures without overwriting the originals

Usage: mogscale [-hatv] [-l ratio] [-s ratio] [-d targetdir] file1 [file2 ...]
 -a              add slinks to thumbnails and source pictures in the current directory
 -l factor       enlarge the picture by factor x prepending lx_ to the new file
 -s factor       shrink the picture by factor x prepending sx_ to the new file
 -q factor       quality factor, for jpg
 -t              test, do no file operation
 -v              verbose, more comments displayed
 -d directory    all scaled files will go to directory. Default is the source file's directory.

Once you have run mogscale, save the following files in a local folder (right click + Save link as), change the .prephp extension to .php for the 3 file names and then upload them on the same directory than the images (php server required for your website).

Don't forget to edit the two last files to reflect your specific data (see comments within those files)

Your page will display a small image linking to the full sized photograph


Using DAR for your backups


Dar is a very powerful command line backup tool.

get Dar at dar's home page


Poll several mail boxes on the command line.


Use fetchmail to poll all your mailboxes and download your messages.

fetchmail needs sendmail service running


Poor man’s play list


If you don’t care too much about gorgeous graphical user interfaces, you can very easily run playlists from command line for virtually any type of media, using your preferred apps for each.