[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Why s port 111 still open?

>>>>> shawn wilson <ag4ve.us@gmail.com> writes:


 > root@shawn-desktop:/home/shawn# find /etc/init.d/ -type f -print0 |
 > xargs -0 -i{} grep -H portmap {}

	As a news:comp.unix.shell regular, I simply cannot leave such a
	command line in its present state.

	First of all, {} is not necessary, but -- may be, as well as -F
	to grep(1), in some circumstances, so:

$ find /etc/init.d/ -type f -print0 |
  xargs -0 -- grep -HF -- portmap 

	Then, find(1) has -exec, so:

$ find /etc/init.d/ -type f -exec grep -HF -- portmap {} + 

	This is both shorter and more efficient.


 > if someone has a better method for finding what is running services,
 > i'm all ears. i've gotten pretty good at tracking these down but have
 > often thought "there's got to be a better way" :)

	I'd do it as follows:

	• # netstat -p (as root) to get the PID;

	• $ readlink /proc/PID/exe (will work as an unprivileged user)
	  to find the executable;

	• $ dpkg -S /usr/bin/executable (as user, too) to find the

FSF associate member #7257	Coming soon: Software Freedom Day
http://mail.sf-day.org/lists/listinfo/ planning-ru (ru), sfd-discuss (en)

Reply to: