Tag Archive for 'port'

How to find out which process is listening on a port

Say that you notice UDP port 323 is open (perhaps via netstat -lun) and you’ve no idea what that is!

With lsof it’s easy to find out which process is guilty:


[15:27 chris ~]$ sudo lsof -i :323
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
chronyd 1044 chrony 1u IPv4 19197 0t0 UDP localhost:323
chronyd 1044 chrony 2u IPv6 19198 0t0 UDP localhost:323

In this case, it’s chrony, the modern time keeping daemon.

Non-standard SSH port and rsync

I use rsync to move most of my data around the place (who doesn’t!?), but sometimes I have to copy files to a server where SSH is running on a port other than 22. How do I tell rsync to use a different port for SSH? Like this:

rsync -e "ssh -p [remote-ssh-port]" ~/local-files/ user@remote-server:remote-files/

Handy indeed. Thanks rsync!

I also like to pass “-P” to the command so that I get a nicer progress than verbose mode, so:

rsync -Pae "ssh -p [remote-ssh-port]" ~/local-files/ user@remote-server:remote-files/

I’m sure that most users will already know this, but it’s handy to put on my blog as a reference for my ageing brain!