Skip navigation

Tag Archives: bash

This is top: top

This is htop:


LOVE coloured terminals.

PS Needs > sudo apt-get install htop.

Being you, reader, a wise person you are going to keep a copy of your entire music library in some external storage device.
Here is a simple example on how to keep your external mirror synchronised with your music library:

rsync -ruv --progress --size-only "$SOURCE" "$DEST" | tee sync.log

-r : recursively sync the subfolders;
-u : skip files that are newer on the destination folder (update);
-v : increase verbosity (print the files that are copied to the destination);
–progress : show a progress bar;
–size-only : skip files with same size.

This way, a new music file that you added in SOURCE is copied in DEST if not present, or if newer and of a different size of the corresponding file (song..) in DEST.
For a two-way synchronisation, just repeat the rsync instruction reversing the order of “$SOURCE” and “$DEST”.

[!!!] End up SOURCE and DEST paths with a trailing slash to copy the directory contents (whereas not having the slash would copy that directory).
[i] Rsync is installed on Ubuntu systems by default [].

I use to keep my library image updated with the cool tree utility of my linux bash.
With the -d option I print directories only, while with -R I crawl down the whole directory tree of my library.

echo -e "$( date +%d\ %B\ %Y )\n" > "$OUTPUT_FILE"
tree "$ROOT" -Rd >> "$OUTPUT_FILE"

Output example:

21 July 2011
 ├── 2 Pac
 │   └── Greatest Hits
 │       ├── cd one
 │       └── cd two
 ├── 883
 │   └── The Best Of
 ├── AA.VV
 │   └── No New York 1979
 ├── AC DC
 │   ├── Back in Black 1980
 │   └── Best of ACDC
 ├── A Certain Ratio
 │   ├── Early 2002
 │   │   ├── early cd1
 │   │   └── early cd2
 │   └── To Each 1981

Essential, practical, Bauhaus.