Check These Out
This is how I list the crontab for all the users on a given system that actually have a crontab.
You could wrap it with a function block and place it in your .profile or .bashrc for quick access.
There's prolly a simpler way to do this. Discuss.
This one-liner is for cron jobs that need to provide some basic information about a filesystem and the time it takes to complete the operation. You can swap out the di command for df or du if that's your thing. The |& redirections the stderr and stdout to the mail command.
How to configure the variables.
TOFSCK=/path/to/mount
FSCKDEV=/dev/path/device
or
FSCKDEV=`grep $TOFSCK /proc/mounts | cut -f1 -d" "`
MAILSUB="weekly file system check $TOFSCK "
Just use '-' to use STDIN as an additional input to 'cat'
Useful for backing up old files, custom logs, etc. via a cronjob.
Random text of length "$1" without the useless cat command.
when your terminal session seems unrensponsive (this normally happen after outputting some binary data directly on your standard output) it may me saned by hitting:
CTRL+J tput sgr0 CTRL+J
Note: don't press the Enter key, just ctrl+j
just use a space to prevent commands from being recorded in bash's history on most systems
Everyone wants to take spaces out of filenames. Forget that. I want to put them back in. We've got tools and filesystems that support spaces, they look better, so I'm going to use them.
Because of how find works I find I need to run this multiple times, if it's renaming subdirs. But it can be re-run without issues.
I got this version of the command from a comment in this underscore-generating command. http://www.commandlinefu.com/commands/view/760/find-recursively-from-current-directory-down-files-and-directories-whose-names-contain-single-or-multiple-whitespaces-and-replace-each-such-occurrence-with-a-single-underscore. All I did was change the regex.
Friday is the 5th day of the week, monday is the 1st.
Output may be affected by locale.
I often use it at my work, on an ovh server with root ssh access and often have to change mod after having finished an operation.
This command, replace the user, group and mod by the one required by apache to work.