mysqldump to a tar.gz

mysqldump –opt <database> | gzip -c | ssh user@wherever ‘cat > /tmp/yourfile.sql.gz’ You can’t use tar in a pipe like this, and you don’t need it anyway, as you’re only outputting a single file. tar is only useful if you have multiple files.

Can you have more than one ~/.ssh/config file?

The ~/.ssh/config file don’t have a directive for including other files, possibly related to SSH’s check for file permissions. Suggestions around this can include a script to cat several changes together either on the system or via checkin hooks on a repository. One might also look into tools such as Puppet or Augeas. However you … Read more

Linux command line best practices and tips?

Use screen, a free terminal multiplexer developed by the GNU Project that will allow you to have several terminals in one. You can start a session and your terminals will be saved even when you connection is lost, so you can resume later or from home.

Colors in bash after piping through less?

Most likely your ls is aliased to ls –color=auto, which tells ls to only use colors when its output is a tty. If you do ls –color (which is morally equivalent to ls –color=always), that will force it to turn on colors. You could also change your alias to do that, but I wouldn’t really … Read more

Clean way to write complex multi-line string to a variable

This will put your text into your variable without needing to escape the quotes. It will also handle unbalanced quotes (apostrophes, i.e. ‘). Putting quotes around the sentinel (EOF) prevents the text from undergoing parameter expansion. The -d” causes it to read multiple lines (ignore newlines). read is a Bash built-in so it doesn’t require … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)