tips

MySQL command line backup and restore

A lot of beginners are very much dependent upon phpMyAdmin for their daily work. However a lot of them are not familiar with the basic command line tool like mysql and mysqldump. These two commands can help a lot when I am working on servers without phpMyAdmin installation.

I will show you how to quickly backup and restore database between your local computer and server.

We have a database called dbproject_local which I will migrate to server. The server already has database dbproject_server.

Converting .wav files to .mp3 files in Ubuntu 9.04

The process is a two step process:

First,
Install the required packages
$ sudo apt-get install libavcodec-unstripped-52

Second,
Use proper command line tools for the conversion
$ ffmpeg -i source.wav -acodec libmp3lame -ab 64k destination.mp3

Now although it looks simple, I wasted two hours trying out different tools lame, mencoder, etc and wrong options with ffmpeg. Unnecessary bheja fry!

Cheers

Downloading whole directory with FTP

It seems that it is not possible to download or upload folders using the ftp command. Until now I have been using FileZilla, the GUI ftp client for most of my ftp works. Well GUI is GUI and is not always available.

Turns out, there is this awesome lftp command that does the job pretty well. It is like the bash shell but for ftp with lots of tricks up its sleeve. It even does a remote auto completion, awesome.

  1. $ lftp
  2. lftp :~> o ftp.servername.com
  3. lftp ftp.servername.com:~> user USERNAMEHERE
  4. Password: PASSWORD HERE

this much is like the old ftp command.

To upload the whole folder to the remove server

  1. lftp :~> mirror -R /path/to/local/folder /path/to/remote/folder

by default, mirror command downloads files from remote source folder to local folder. Option -R means reverse the process where by, instead of downloading, it uploads the local/folder to remote/folder location.

Syndicate content