Kind of a mish-mosh of snippets below. A lot of them are useful if you’re managing servers. The rest are useful more generally and occasionally. Many of these utilities may already be on your system, others you may have to install. (Hopefully you’re using a Linux distro that has all of these in its standard software repository so you can just search, click, install.)
Get a random number between 1 and 100
Actual non-swapped physical memory in use by a process in kilobytes
For example, to find out the total amount of memory being used by all Apache processes, use “apache” as the process name.
Count the number of processes with a given name
Total system memory
This is useful in scripts that need to compare memory against the total memory available on a system.
Print all lines in a file that contain a pattern
Print all lines in a file that do not contain a pattern
Do something once, at some later time
This one is kind of odd. For example, first you type at 09:30 at a console. A prompt will appear. Then you type commands you would like executed at that time. Press CTRL-D when you are done entering commands.
Mail output of a command to someone
The sed -e bit prepends the subject line to the beginning of the output for sendmail.
Relabel an ext2/ext3 (Linux) formatted drive
For example, sudo e2label /dev/sda1 data.
Relabel a DOS formatted drive
First, create ~/.mtoolsrc:
Then:
Convert password protected PDF files to unprotected PS
I used this the other day when I needed to load a password protected PDF into GIMP.