Check These Out
Use case: folder with flac files with tree structure ../artist/album/number-title.flac
1) convert flac->mp3 in the same folder: http://www.commandlinefu.com/commands/view/6341/convert-all-.flac-from-a-folder-subtree-in-192kb-mp3
2) search for mp3 files and recreate tree structure to another path: http://www.commandlinefu.com/commands/view/8853/copy-selected-folder-found-recursively-under-src-retaining-the-structure
3) move all mp3 files to that new folder: this command
Run "ps -x" (process status) in the background every hour (in this example).
The outputs of both "nohup" and "ps -x" are sent to the e-mail (instead of nohup.out and stdout and stderr).
If you like it, replace "ps -x" by the command of your choice, replace 3600 (1 hour) by the period of your choice.
You can run the command in the loop any time by killing the sleep process. For example
$ ps -x
2925 ? S 0:00.00 sh -c unzip E.zip >/dev/null 2>&1
11288 ? O 0:00.00 unzip E.zip
25428 ? I 0:00.00 sleep 3600
14346 pts/42- I 0:00.01 bash -c while true; do ps -x | mail (...); sleep 3600; done
643 pts/66 Ss 0:00.03 -bash
14124 pts/66 O+ 0:00.00 ps -x
$ kill 25428
You have mail in /mail/(...)
Silly Perl variant.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
To replace foo by bar, but not execute, do ^foo^bar^:p
To replace all foo by bar, but not execute, do ^foo^bar^:&:p
Quick write some notes to a file with cat. Ctrl+C when you have finish.
If you have used bash for any scripting, you've used the date command alot. It's perfect for using as a way to create filename's dynamically within aliases,functions, and commands like below.. This is actually an update to my first alias, since a few commenters (below) had good observations on what was wrong with my first command.
# creating a date-based ssh-key for askapache.github.com
$ ssh-keygen -f ~/.ssh/`date +git-$USER@$HOSTNAME-%m-%d-%g` -C 'webmaster@askapache.com'
$ # /home/gpl/.ssh/git-gplnet@askapache.github.com-04-22-10
# create a tar+gzip backup of the current directory
$ tar -czf $(date +$HOME/.backups/%m-%d-%g-%R-`sed -u 's/\//#/g'
Open up vi or vim at the first instance of a pattern in [file]. Useful if you know where you want to be, like "PermitRootLogin" in sshd_config. Also, vi +10 [file] will open up a file at line 10. VERY useful when you get "error at line 10" type of output.