The minimalist webmaster command list

This command shows the appended lines in a file as and when the file grows. Very useful for debugging.

tail -f /var/log/messages

Check and Repair MySQL Tables Using Mysqlcheck

mysqlcheck -c db_name db_table -u root -p

if you want just to check all the tables in the database, omit the table name.

Backup a database:

mysqldump -u root -p db_name > db_name.bak.sql

Backup a table of your database:

mysqldump -u root -p db_name db_table > db_name_db_table.bak.sql

Restore a database:

mysql -u root -p[root_password] [database_name] < dumpfilename.sql

Perform a search & replace in a column of your database (very powerful command, always backup before, you can mess with it):

UPDATE table SET column_name=replace(column_name,'searched_string','new_string');

Sync files between a remote server and the server you are logged in (very useful):

rsync -av --rsh='ssh -p22' [email protected]<remote_host>:/path/to/dir/ /path/to/dir/

Backup a directory (with all files and subdirectories) preserving permissions:

tar -cvpzf /BackupDirectory/backupfilename.tar.gz /ImportantData/directory/path

To decompress a tar.gz file:

tar -xvzf backupfilename.tar.gz

Check disk space:

df -h

Contact me if you want to contribuite to this list, thanks!