How to find out what application that using specific port

Just a case if you want to know some application or service who is running under specific port :

$ netstat -tulpn | grep :80

Sometimes you need to run with sudo to see all services :

$ sudo netstat -tulpn | grep :80

Output :

tcp        0      0    *               LISTEN      1393/nginx.conf

It turns out that 1393 is the pid of service

Git cheatsheet

list branch

git branch

move to another branch

git checkout your-branch

hard reset branch

git reset --hard origin/master

create new branch

git checkout -b new-branch

delete local branch

git branch -D your-branch

merge from develop to master

git merge develop

init on existed project and push master for the first time

git init
git remote add origin ssh://
git add .
git commit -am "initial commit"
git push -u origin master

Start VM in virtualbox headless mode

I want to start my VM virtualbox but without the GUI interface, cause if I need to get the access to my VM, I just can SSH into it. So it won’t need any GUI interface and I don’t have to open up Virtualbox first to start my VM.

This is a simple command line to start up your VM in headless mode, once it gets started, you can just SSH into your VM.

VBoxManage startvm myubuntu --type headless

Poweroff your VM with command line:

VBoxManage controlvm myubuntu poweroff

Or you can just init 0 in your VM when you’re done, LOL

Setup SSH key passphrase only ask once

Sometimes it’s annoying when you’re trying to work with your project and whenever you need to enter your key passphrase. So I wanna make this passphrase prompt ask only once.

vim ~/.bash_profile

and put this at the bottom of the file :

eval $(ssh-agent)

Or if you don’t want to be asked for passphrase at all, you can just generate new passphrase with no password.