Check These Out
The same as the other two alternatives, but now less forking! Instead of using '\;' to mark the end of an -exec command in GNU find, you can simply use '+' and it'll run the command only once with all the files as arguments.
This has two benefits over the xargs version: it's easier to read and spaces in the filesnames work automatically (no -print0). [Oh, and there's one less fork, if you care about such things. But, then again, one is equal to zero for sufficiently large values of zero.]
eg:
Already running cmd
$sleep 120
Substitution cmd
$c=$(pgrep sleep) && sleep 5 && kill $c
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"
}
Doubt it actually generates valid mac addresses but this version doesn't need any external commands so it runs much faster.
Much shorter as well.
it is not work with Cygwin's bash3.X. Test in Linux.
use printf "%'f" number while it is floating point number
Put it into your sh startup script (I use
alias scpresume='rsync --partial --progress --rsh=ssh'
in bash). When a file transfer via scp has aborted, just use scpresume instead of scp and rsync will copy only the parts of the file that haven't yet been transmitted.
Apart from an exact copy of your recent contents, also keep all earlier versions of files and folders that were modified or deleted.
Inspired by EVACopy http://evacopy.sourceforge.net
Shorten any Url using bit.ly API, using your API Key which enables you to Track Clicks
I have it as a Function in my .bash_aliases
[code]
shorten ()
{
longUrl=$1;
curl "http://api.bit.ly/shorten?version=2.0.1&longUrl=LONG_URL_YOU_WANT_SHORTENED&login=rungss&apiKey="
}
[/code]
Here is an Output showing the Function Detail..
[konsole]
bijay@bijay:$ type shorten
shorten is a function
shorten ()
{
longUrl=$1;
curl "http://api.bit.ly/shorten?version=2.0.1&longUrl=$longUrl&login=rungss&apiKey=R_48d7e0b40835b09e3861bd455f7abec7"
}
[/konsole]
You need to have fortune and cowsay installed. It uses a subshell to list cow files in you cow directory (this folder is default for debian based systems, others might use another folder).
you can add it to your .bashrc file to have it great you with something interesting every time you start a new session.
This command asks for the station name and then connects to somafm, Great for those who have linux home entertainment boxes and ssh enabled on them, just for the CLI fiends out there ( I know I'm one of them ;)
Also, don't forget to add this as alias(ie alias somafm="read -p 'Which Station? "; mplayer --reallyquite -vo none -ao sdl http://somafm.com/startstream=${REPLY}.pls")