Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1119
  • Last Modified:

ls and netstat command equivalency

What are the Solaris equivalents for these Linux commands (ls and netstat) that would allow us to show this output?

# ls -l /proc/[PID]/fd
lr-x------ 1 root root 64 Jan 16 05:36 0 -> /dev/null
l-wx------ 1 root root 64 Jan 16 05:36 1 -> /dev/null
l-wx------ 1 root root 64 Jan 16 05:36 2 -> /dev/null
lrwx------ 1 root root 64 Jan 16 05:36 3 -> socket:[PID]

# netstat -fa
Proto Recv-Q Send-Q Local Addr Foreign Addr State  PID/Program name
tcp   0      0      *:5006     *:*          LISTEN [PID]//usr/bin/grep

We're trying to show how to detect a daemon that has a network socket through the /proc process directory.

Any ideas?  We're using Solaris 8 version 2/04 in our labs.
0
bbunner
Asked:
bbunner
2 Solutions
 
neteducationCommented:
afaik this is not directly through /proc possible.

What you can do is to use

pfiles <PID>

to see what sockets this PID is on.... then you could do a little script similar to the following

for i in `ls /proc`
do
echo $i
pfiles $i | grep port | grep 514
done

to find out

0
 
wesly_chenCommented:
> # netstat -fa
Is it
netstat -pa
?

Please download "lsof" from http://www.sunfreeware.com/
gunzip lsof*.gz
pkgadd -d lsof-<version>.local
and
/usr/local/bin/lsof -n -i

Wesly
0
 
Mike R.Commented:
Hmmm...I was able to run the command "ls -l /proc/[PID]/fd" directly on my Solaris 9 box and got normal output.  

I am not sure about the netstat command, as I don't know what the linux "-f" and -a" switches are trying to accomplish.  I have a redhat 9 box here, but its man page doesn't show the "-f" and "-a" options.

Best of luck!
M
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now