Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Saturday, October 20, 2012

Find PID listening specific port

To find which process is listening a specific port, the 3 options below can be used.

netstat -alnp | grep ::80
or
fuser -v 80/tcp
or
lsof -nPi tcp:80

Wednesday, April 25, 2012

Quit ssh with out killing running process

Since I need to keep start.jar of jetty running on EC2. I need to quit the ssh without killing the current running jetty process. There is a tool called "screen" can do this easily.

Follow the steps below
1.
screen
2.
sudo java -jar start.jar
3.
ctrl+a and then ctrl+d
4.quit ssh.

Tuesday, March 27, 2012

Sudo xxx complaining command not found

Problem:
Just installed doctrine. I found if I use command "doctrine" straight away it works but not working with sudo. When I typed in
sudo doctrine
it complains
sudo: doctrine: Command not found
Then I tried to use full path of doctrine with sudo which worked. So I think this should be caused by that sudo command does not use the personal path environment.

Using full qualified path every time is annoying.

Solved:
Create a file at
~/.bash_aliases 
with content
alias sudo='sudo env PATH=$PATH $@'
Logout and login again.