-
Find which directories are the disk hogs
du --max-depth=1 -h | sort -h
-
Copy a mysql database from one server to another via ssh
mysqldump -u root -pPASSWORD --all-databases | ssh [email protected] 'cat - | mysql -u root -pPASSWORD'
Note, you must restart the target mysql server afterwards, and if you do you may get the error "ERROR 1045 (28000): Access denied for user 'debian-sys-maint'@'localhost'" (on debian at least).
Fix this by executing the command:
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'THE PASSWORD' WITH GRANT OPTION;
Where 'THE PASSWORD' is the password found in /etc/mysql/debian.cnf
-
Message users on a remote server
echo "message" | ssh user@host wall
or
echo "message" | ssh user@host sudo wall
to send something as the admin.
- How many messages are there in the queue?
exim -bpc
- Test routing to an address (useful for problem diagnosis)
exim -bt [email protected]
- Restarting a mail queue and attempt redelivery
exim -q -v
- Thaw all messages
exim -bp | grep -i frozen | awk '{print $3}' | while read LINE; do exim -Mt $LINE; done
- Rsync files to server as root user
rsync -Pavz -e "ssh -i KEYPAIR.pem" --rsync-path "sudo rsync" LOCALFILES ubuntu@HOSTNAME:REMOTEDIR/
-
Remove a URL from cache / force refresh
squidclient -m PURGE http://url
-
Find all translation content containing a string (in this case "Friend")
find . -name en.php | xargs -i{} cat {} | egrep "=.["|'][f|F]riend*"