Category Archives: Linux Commands

How to install node/nodejs using source code in ubuntu 14.04/16.04/18.04 server

Sometimes installing from ppa’s/source-lists will not be working smoothly, in that case install using source can be better and easy one option. Installation of nodejs on ubuntu or any linux flavour from source is easy. You need to just follow below steps. Steps are below.


1. Download it from source distribution list.

or simply by using below commands on terminal.


2- untar the downloaded file.

tar -xzf node-v11.3.0.tar.gz

3. move to unzipped directory

cd node-v11.3.0

4. Configure source code dependencies, To generate makefile from


5. issue make command, uses make file to build program.


6. issue make install command, uses makefile to to install program.

make install

It will complete the installation process, now you can check the node installed version using below command.

node -v

For more details you can refer to

git pull vs git fetch

git pull — Incorporates changes from a remote repository into the current branch. In its default mode,

In the simple terms, git pull does a git fetch followed by a git merge.

More precisely, git pull runs git fetch with the given parameters and calls git merge to merge the retrieved branch heads into the current branch. With –rebase, it runs git rebase instead of git merge.

You can do a git fetch at any time to update your remote-tracking branches under refs/remotes/<remote>/.

A git fetch, operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy.

A git pull is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches.



As many of us have heard about the terms like SSH, Putty, VNC . Let’s see how to they differ with each other.

SSH is a protocol for encrypted connections between computers(For making connections, ssh client needs to be installed on local computer, and ssh server needs to be installed at remote computer) . Its simple to use, SCP command is also based on ssh, with help of ssh one can perform task over remote computer.

PuTTY is a free implementation of SSH and Telnet for Windows and Unix platforms, along with an xterm terminal emulator.

PuTTY is a GUI terminal emulator (able to run shells, which in turn run commands), while the usual SSH application is a shell (not a terminal emulator). PuTTY has been ported to Unix (and Unix-like) systems as pterm.

As a best practice, keys are recommends over passwords. PuTTY is the terminal client but you can get a couple of other tools from the same author. PSFTP and PSCP offer secure file transfers. These tools are as easy to use as PuTTY and work pretty much the same way.

VNC exports a whole session, desktop and all, while ssh will run a single program and show its windows on your workstation.

The VNC server exports a session that survives even when you disconnect your screen, and you can reconnect to it later with all the windows open etc. This is not possible with an ssh X tunnel, since when your X server dies, the windows go away.

File Permissions In Linux


In Linux(like ubuntu/cent/fedora/kali etc.) and Unix, everything is a file. Directories are files, files are files and devices are files. Devices are usually referred to as a node, however, they are still files. All of the files on a system have permissions that allow or prevent others from viewing, modifying or executing. If the file is of type Directory then it restricts different actions than files and device nodes. The super user “root” has the ability to access any file on the system. Each file has access restrictions with permissions, user restrictions with owner/group association. Permissions are referred to as bits.

There are three types of access restrictions:

Permission | Action  | chmod option
read       | (view)  | r or 4
write      | (edit)  | w or 2
execute    |(execute)|x or 1

There are also three types of user restrictions:

User  | ls command output
owner | -rwx------
group |----rwx---
other |-------rwx

Folder/Directory Permissions

Directories have directory permissions. The directory permissions restrict different actions than with files or device nodes.
Permission | Action                           | chmod option
read       | (view contents, i.e. ls command) | r or 4
write      | (create or remove files from dir)|w or 2
execute    | (cd into directory)              | x or 1

  • read allows viewing the directories contents, i.e. ls command
  • write allows creating new files or deleting files in the directory. (Note: write access for a directory allows deleting of files in the directory even if the user does not have write permissions for the file!)
  • execute restricts or allows changing into the directory, i.e. cd command

SCP Command use tips and tricks

scp command

What is SCP

scp stands for secure cp (copy), which means you can copy files across ssh connection(securely encrypted). It is a very secure way to copy files between computers.

It uses by default the port 22, and connect via an encrypted connection using SSH, in short it using all security setting applied for an ssh connections, for transferring data over network during copy of file from one host to another.

When copying a source file to a target file which already exists, scp will replace the contents of the target file (keeping the inode).

scp have various options, which can be specified over command line.

Few Examples of Scp Commands

Copy one single local file to a remote destination

scp [options [-r Recursively copy entire directories]] /path/to/source-file username@hostname:/path/to/destination-folder/

So, if you want to copy the file /home/user/table.csv to a remote host named and copy there to abhishek’s home folder, use this command.

scp /home/user/table.csv

Copy one single file from a remote server to your current local server

scp username@hostname:/path/to/source-file /path/to/destination-folder

example body could be similar to .
scp /home/abhishek/

You can copy multiple file from host to remote by just replacing file name with ‘directory-name/*’ options.

Copy one single file from a remote server to another remote server

With scp you can copy files between remote servers from a third server without the need to ssh into any of them, all weight lifting will be done by scp itself.

scp user1@server1:/path/to/file user2@server2:/path/to/folder/

Copy multiple files with one command

You can copy multiple files at once without having to copy all the files in a folder, or copy multiple files from different folders putting them in a space separated list.

scp file1.txt file2.txt file3.txt

Copy all files in a folder recursively to a remote server

scp -r /home/abhishek/html/*

SSH Command Tips and Tricks

ssh man

SSH is some kind of an abbreviation of Secure SHell. It is a protocol that allows secure connections between computers.

In more detail we can summarize it as, ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine. It is intended to replace rlogin and rsh, and provide secure encrypted communications between two untrusted hosts over an insecure network.

ssh connects and logs into the specified hostname (with optional user name). The user must prove his/her identity to the remote machine using one of several methods depending on the protocol version used.

Few Use Case Examples

Assuming you are using any Linux(Like Ubuntu etc.) You can perform ssh command over terminal.

The simplest pattern would be of SSH command as below with minimum option.

ssh yourusername@yourserverip

You will still be asked for a password. For security reasons, it is not even possible to directly specify the password in the syntax. You will always be asked interactively, unless you start configuring the server in an advanced way like (You may have added your system public key to remote system from which you are connecting, in this way you will be only asked a few question during first time login, not the password for your ssh username using which you are logging to system).

You can specify your port too while issuing ssh command, if you do not wish to use default port(22) setting, due to any of reasons.

ssh -p portno yourusername@yourserverip

Sometimes, especially in scripts, you may want to connect to the remote server, and run a single command and then exit again.

ssh yourusername@yourserverip checkinfo

Authentication Methods

The methods available for authentication are: GSSAPI-based authentication, host-based authentication, public key authentication, challenge-response authentication, and password authentication. Authentication methods are tried in the order specified above, though protocol 2 has a configuration option to change the default order: PreferredAuthentications.

Public Key based Authentication

In most of situation you may find you are using public key based Authentication.
Public key authentication works as follows: The scheme is based on public-key cryptography, using cryptosystems where encryption and decryption are done using separate keys, and it is unfeasible to derive the decryption key from the encryption key. The idea is that each user creates a public/private key pair for authentication purposes. The server knows the public key, and only the user knows the private key. ssh implements public key authentication protocol automatically, using either the RSA or DSA algorithms.

Creating of public keys can be done using ssh-keygen command.