Useful linux commands and notes

2012-09-02 12:39 by Ian

This page documents useful linux tricks and links that are helpful and probably not obvious.

Other people's blog pages that are really helpful:
HOWTO: Whole Disk Backup and Recovery with dd, gzip, and p7zip. Thank you, Mr. Kolich, you saved me lots of disk space.

Tools that are worth knowing how to use:

Working with Portage

From syslog.h
When writing logging systems, keeping this convention will increase portability and make life easier.
#define	LOG_EMERG	0	/* system is unusable */
#define	LOG_ALERT	1	/* action must be taken immediately */
#define	LOG_CRIT	2	/* critical conditions */
#define	LOG_ERR		3	/* error conditions */
#define	LOG_WARNING	4	/* warning conditions */
#define	LOG_NOTICE	5	/* normal but significant condition */
#define	LOG_INFO	6	/* informational */
#define	LOG_DEBUG	7	/* debug-level messages */

One-off commands that are helpful:
Recursively delete all subversion metadata:
find . -name ".svn" -exec rm -rf {} \;

Recursively count the number of files in each subdirectory of the present path. (Thanks, Jason!):
find . -maxdepth 1 -type d | while read -r dir; do printf "%s:\t" "$dir"; find "$dir" | wc -l; done

MySQL Usefulness:
Get the difference between timestamps (doc):

General System Setup:
Why is this not yet automatic?
rm `which vi`
ln -s `which vim` /bin/vi