Check These Out
This command utilizes 'pv' to show dd's progress.
Notes on use with dd:
-- dd block size (bs=...) is a widely debated command-line switch and should usually be between 1024 and 4096. You won't see much performance improvements beyond 4096, but regardless of the block size, dd will transfer every bit of data.
-- pv's switch, '-s' should be as close to the size of the data source as possible.
-- dd's out file, 'of=...' can be anything as the data within that file are the same regardless of the filename / extension.
My take on the original: even though I like the other's use of -exec echo, sed just feels more natural. This should also be slightly easier to improve.
I expanded this into a script as an exercise, which took about 35 minutes (had to look up some docs): http://bitbucket.org/kniht/nonsense/src/7c1b46488dfc/commandlinefu/quick_image_gallery.py
$ sleep 1h ; sudo command
or
$ sudo sleep 1h ; sudo command
won't work, because by the time the delay is up, sudo will want your password again.
A commandline version of the notepad in a browser: http://www.commandlinefu.com/commands/view/12161/notepad-in-a-browser-type-this-in-the-url-bar
All credit to the origional author of this fantastic command, whos only failing as most of the comments pointed out was that it wasn't a command... well, now its a command. Send all upvotes to dtlp747.
For example, to remove line 5 from foo, type: vi +5d +wq foo
This will cause your machine to INSTANTLY reboot. No un-mounting of drives or anything.
Very handy when something has gone horribly wrong with your server in that co-location facility miles away with no remote hands!
Suspect this works with all 2.2, 2.4 and 2.6 Linux kernels compiled with magic-syskey-request support.
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"
}