sudo apt install nginx
List all local and remote branches
git checkout <branch_name>
git checkout -b <branch_name>
Stage file (to consider the file in commit)
Stage new and modified, without deleted
Stage modified and deleted, without new
Unstage file (Remove staged file from staged files list)
Unstage a particular file
git reset <file_name>
Pull in active branch from the same branch in server
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>
sudo apt-get install npm
NPM - Install all dependency packages
Install Process Manager (Process Manage is used to run any service 24 hours)
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
Get number of files in a directory
zip -r <file-name>.zip <dir-name>/
Connect with redis server
redis-cli -h <host-name> -p <port>
Get redis server information
List all keys containing the string "cache"
SET <key-name> <key-value>
Get value of a particular key
Copy file from local server to s3 bucket or vice-versa
aws s3 cp <source-path> <destination-path>
e.g.
aws s3 cp my-folder/file1.txt s3://s3-folder/
aws s3 cp s3://s3-folder/file2.txt my-folder/
Copy directory from server to s3 bucket or vice-versa
aws s3 cp <source-path> <destination-path> ./ --recursive
e.g.
aws s3 cp my-folder s3://s3-folder/ --recursive