Install and use drush in a shell

Go to a destination which you can create folder. Execute the command:

wget --quiet -O - | tar -zxf - -C ./

Then, you have drush in your hand.

./drush/drush status


Latitude and Longitude In Google map. How to.

Paste in browser:


Render a Views in Drupal 6

Code copied from og module:

  $closerview = views_get_view('viewscloser');
  $closerview->is_cacheable = FALSE;
  // TODOL: not working
  $closerview->override_path = "node/$node->nid";
  $closerview->display_handler->set_option('style_options', array('description' => $node->og_description));
  print $closerview->render();

DB backup restore command line


mysqldump -u dbuser -p db_name | gzip -9 > db.sql.gz


New DB:
gunzip < db.sql.gz | mysql -u dbuser -p dbname
Existed DB:
mysqlimport -u dbuser -p dbname db.sql
// Sorry this version is not in compressed

Find files contains text Linux

find . -type f -exec grep -il "Text to find" {} \;

Bonus:  Search command in WinSCP

find . -type f -exec grep -il "!?prompt?!" {} \;

Backup and Restore in UBUNTU

cd targetfolder
tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz ./

Backup with split

cd targetfolder
tar -cvpz backup.tar.gz --exclude=/backup.tar.gz ./ | split -d -b 3900m - ./backup.tar.gz. 


tar -xvpzf backup.tar.gz -C targetfolder

Export with concat:

cat *tar.gz* | tar -xvpzf - -C targetfolder

List all cron jobs by crontab in UBUNTU

Command line:

 for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done