Useful Commands in Ubuntu

Git

Install git

sudo apt install nginx

List checked out Branches

git branch

Change Branch

git checkout <branch_name>
git checkout -b <branch_name>

Stage file (to consider the file in commit)

Stage a particular file

git add <file_name> 

Stage all files

git add -A

Stage new and modified, without deleted

git add 

Stage modified and deleted, without new

git add -u  

Unstage file (Remove staged file from staged files list)

Unstage a particular file

git reset <file_name> 

Unstage all files

git reset 

Take Pull

Pull in active branch from the same branch in server

git pull 

Pull in active branch from master branch server

git pull origin master

Pull in active branch from the specified branch in server

git pull origin <branch_name> 

NPM

Install npm

sudo apt-get install npm 

NPM - Install all dependency packages

npm install

PM2 Process Manager

Install Process Manager (Process Manage is used to run any service 24 hours)

npm install pm2 -g

Start the process to run continuously

pm2 start --name <process_name> <process_command> 

So for e.g. To start the nodejs service with pm2, the command can be like

pm2 start --name node_service node src/app.js

To start reactjs service with pm2, the command can be like

pm2 start --name reactjs_service npm -- start

Check the status of all processes

pm2 [list|ls|status]

Restart/Stop/Delete a particular process

pm2 restart <process_name>
pm2 stop <process_name>
pm2 delete <process_name> 

Restart/Stop/Delete all processes

pm2 restart all
pm2 stop all  
pm2 delete all