Mac/Linux tips

  1. To kill node(other background tasks)
$ ps aux | grep node #lists node instances with their PID
$ sudo killall node #in case we want to kill all node instances
$ sudo kill -9 `ps aux | grep node | tail -1 | awk '{print $2}'`
$ sudo purge #to free up un-used memory on Mac

Use sh sudo on your own risks!

To update DigitalOcean droplets' Linux machine

$ sudo apt-get update #update package information
$ sudo apt-get upgrade #updating actual packages
$ sudo shutdown -r now #restart the droplet

Human readable file size listing

$ ls -lh

Compressing and uncompressing files

$ zip -r -X files #-X removes _MACOSX dirs
$ unzip #uncompress
$ tar -zcvf archive.tar.gz folder
$ tar -zxvf archive.tar.gz #un-tar

Mounting USB drive

NB: Compiled from QA on DO

understanding virtual hosts on ubuntu machine

These are steps I use(used to) to install a new website on an Apache server running on Ubuntu using "virtual host/domain" feature.

$ sudo mkdir /var/www/mysite #creates a new site
$ sudo gedit /etc/apache2/sites-available/mysite #or copy an existing one
$ sudo gedit /etc/hosts #adds site name in hosts
$ sudo a2ensite mysite #enables the site
$ sudo /etc/init.d/apache2 reload reload or restart #reloads apache server


  1. a2ensite Will create the correct symlinks in sites-enabled directory to allow the site configured in sitefilename to be served
  2. use sudo on your own peril :-(
Show Comments