Check These Out
I use this command (PS1) to show a list bash prompt's special characters. I tested it against A flavor of Red Hat Linux and Mac OS X
Obviously, you can replace 'man' command with any command in this command line to do useful things. I just want to mention that there is a way to list all the commands which you can execute directly without giving fullpath.
Normally all important commands will be placed in your PATH directories. This commandline uses that variable to get commands. Works in Ubuntu, will work in all 'manpage' configured *nix systems.
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"
}
Create ISO image of a folder in Linux. You can assign label to ISO image and mount correctly with -allow-lowercase option.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Save the current directory without having to leave it. When you do decide to leave the current directory, use popd to return to it.
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"
}
When you have different digital cameras, different people, friends and you want to merge all those pictures together, then you get files with same names or files with 3 and 4 digit numbers etc. The result is a mess if you copy it together into one directory.
But if you can add an offset to the picture number and set the number of leading zeros in the file name's number then you can manage.
OFFS != 0 and LZ the same as the files currently have is not supported. Or left as an exercise, hoho ;)
I love NF="${NF/#+(0)/}",it looks like a magic bash spell.
-l outputs only the file names
-i ignores the case
-r descends into subdirectories