Linux

MongoDB

MongoDB is document based NoSQL database. This means that:

  • it has no schema
  • it has no relations
  • it is agile and scaleable
  • stores information in nested documents of two-dimensional key/value pairs.

What are the benefits of using MongoDB?

  • you do not have to pre-define your schema or data model
  • works nicely with JavaScript
  • ideal for client-side applications

Installing MongoDB

Installing MongoDB on Mac with Homebrew

Nginx webroot

Following are default locations of nginx webroot with standard installations:

  • Ubuntu 12.04: /usr/share/nginx/www
  • Ubuntu 14.04: /usr/share/nginx/html
  • Mac OS (brew): /usr/local/var/www

On Ubuntu 14.04, the webroot is defined in

/etc/nginx/sites-enabled/default

You should something like:

Installing Nginx on Ubuntu

Nginx is a powerful web server which is rapidly taking market share from Apache. Here you will see how easy it is to install and use Nginx.

sudo apt-get update
sudo apt-get install nginx

Installation complete! Type the IP of your web host in the browser to test it. If you don't know your IP, run the following command

ip addr show | grep inet

It will list several IPs, use the one attached to eth0 or eth1.

Starting, Stopping, Restarting Nginx

Installing npm on ubuntu

Update your repository if you haven't done so in a long time

$ sudo apt-get update

Install nodejs

$ sudo apt-get install nodejs

Install npm

$ sudo apt-get install npm

Check if npm installed correctly

$ which npm
/usr/bin/npm
$ npm

You shouldn't get any error messages and the second command should give you usage instructions.

Batch renaming files

Batch renaming files in Linux requires writing or using a shell script. If you don't have the time to write or find a shell script to batch rename your files, simply install and use the gprename utility. It is a graphical utility which is suitable for most batch renaming tasks.

To install on Ubuntu

$ sudo apt-get install gprename

To use, simply type gprename in the terminal or Ubuntu Dashboard.

(adsbygoogle = window.adsbygoogle || []).push({});

Linux symbolic links

A symbolic link is a link which points to another file. In Microsoft windows, this is referred to as a shortcut and in Macintosh, an alias. To create a symbolic link:

$ ln -s source_file symbolic_link
$ ln -s readme.txt pointer-to-readme.txt

Now if you do:

$ cat readme.txt
$ cat pointer-to-readme.txt

Both commands would print the contents of the same file, readme.txt.

Pages