10 Jul, 2010
When you want to backup your mysql databases, you usually do mysqldump ... --all-databases or mysqldump ... --databases mysql ... but you end up with the whole mysql table which is a pain to insert back when you need it because it can mess up the root password or the debian-sys-maint user...
If you wish to just backup all the users and privileges other than root and debian-sys-maint, you can use this command:
mysqldump -nt -uroot -p -w"User NOT LIKE 'root' AND User NOT LIKE 'debian%'" mysql user db > users_privs.sql
Here's an explanation of each of the options:
- -nt: Do not add "drop table" and "create table".
- -uroot -p: Connect as root and ask for a password
- -w...: Add a "WHERE" condition to each query. We exclude everything related to root and debian-sys-maint.
- mysql user db: Dump the user and db tables from the mysql database.
- > users_privs.sql: Store the sql dump into the users_privs.sql file.
――
30 Mar, 2010
Possibly you will need to either do a diff between files where they don't use the same new line character.
Because the new line character is OS-dependant, there are issues when doing a diff on these files when you are not using that same OS.
And there are also times where you just want diff to ignore all spaces and new lines...
The --ignore-all-space option for diff is really useful in these two cases. It will check for differences between the given files ignoring spaces or new lines whether there is none, one or more
Read the rest of this entry »
――
24 Jun, 2009
If you are a developer or simply a command-line geek/fan, there are times where you type some documents using the command line, like for README's or for documentation. It is also important to have a very good writing in English if you wish to distribute those files.
Hunspell can help you with spell-checking. It is based on MySpell and contains a nice terminal interface to spell-check your files.
Read the rest of this entry »
――
17 Jun, 2009
scanerrlog offers the possibility to generate a summary or report about Apache errors and sort them depending on how frequent they are.
To install it (for Ubuntu users):
sudo apt-get install scanerrlog
or use Synaptic and search for scanerrlog.
It's written in Python, and it is very easy to use it. (type 'man scanerrlog' in a terminal to see the manual page)
I tested it with Apache2 log files using the following command:
scanerrlog -f text -o /tmp/log.txt /var/log/apache2/*.log
- -f : format (text, pdf, html, xml)
- -o : output file
- args : log files
Read the rest of this entry »
――