Check These Out
tar(1) and cpio(1) are not fully platform agnostic, although their file formats are specified in POSIX.1-2001. As such, GNU tar(1) might not be able to extract a BSD tar(1) archive, and ivce versa. pax(1) is defined in POSIX.1-2001. To extract an archive:
$ pax -rf archive.tar
Scans the file once to build a list of line numbers that contain non-printable characters
Scans the file again, passing those line numbers to sed as two commands to print the line number and the line itself. Also passes the output through a tr to replace the characters with a ?
By defining a function "gh" as shown here, it saves me typing "history | grep" every time I need to search my shell history because now I only have to type "gh".
A nifty time saver :-)
You can also add the "gh" function definition to your .bashrc so it is defined each time you login.
(updated 2015_01_29: changed from hg to gh to avoid clash with that other hg command.
mnemonic: gh = grep history)
Installs pip packages defining a proxy
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}
Assumed dir A, B, C are subdirs of the current dir
Exact syntax of the command is:
rsync -v -r --size-only --compare-dest=/path_to_A/A/ /path_to_B/B/ /path_to_C/C/
(do not omit end-slashes, since that would copy only the names and not the contents of subdirs of dir B to dir C)
You can replace --size-only with --checksum for more thorough file differences validation
Useful switch:
-n, --dry-run perform a trial run with no changes made
Shows all block devices in a tree with descruptions of what they are.
This command is very helpful when we need to duplicate a test scenario and first we want to find out the installed libraries together with the version and release numbers and architecture. (look example)
Command can be tuned by choosing just the names of libraries we are interested in. For example glibc and gcc.
To take information about the characteristics of the installed memory modules.