Check These Out
This command will place symbolic links to files listed in an m3u playlist into a specified folder. Useful for uploading playlists to Google Music.
prefix = The full path prefix to file entries in your .m3u file, if the file paths are relative. For example, if you have "Music/folder/song.mp3" in your list.m3u, you might want to specify "/home/username" as your prefix.
list.m3u = Path to the playlist
target_folder = Path to the target folder in which you would like to create symlinks
Shows all block devices in a tree with descruptions of what they are.
Extracted from http://www.howtogeek.com/wiki/Recursively_Add_Changed_Files_to_Subversion
I like this better than some of the alternatives using -exec, because if I want to change the string, it's right there at the end of the command line. That means less editing effort and more time to drink coffee.
Ever needed to test firewalls but didn't have netcat, telnet or even FTP?
Enter /dev/tcp, your new best friend. /dev/tcp/(hostname)/(port) is a bash builtin that bash can use to open connections to TCP and UDP ports.
This one-liner opens a connection on a port to a server and lets you read and write to it from the terminal.
How it works:
First, exec sets up a redirect for /dev/tcp/$server/$port to file descriptor 5.
Then, as per some excellent feedback from @flatcap, we launch a redirect from file descriptor 5 to STDOUT and send that to the background (which is what causes the PID to be printed when the commands are run), and then redirect STDIN to file descriptor 5 with the second cat.
Finally, when the second cat dies (the connection is closed), we clean up the file descriptor with 'exec 5>&-'.
It can be used to test FTP, HTTP, NTP, or can connect to netcat listening on a port (makes for a simple chat client!)
Replace /tcp/ with /udp/ to use UDP instead.
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"
}
I've been using colordiff for years. wdiff is the new fav, except its colors. Word delimited diffs are more interleaved, easing the chore of associating big blocks of changes.
It's also possible to delay the extraction (echo "unrar e ... fi" |at now+20 minutes) wich is really convenient!
To make it even more practical, make sure you can login to the ssh server using a keypair.