?
Solved

ls and netstat command equivalency

Posted on 2005-03-24
6
Medium Priority
?
1,104 Views
Last Modified: 2013-12-27
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
Comment
Question by:bbunner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 10

Accepted Solution

by:
neteducation earned 500 total points
ID: 13621714
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
 
LVL 38

Assisted Solution

by:wesly_chen
wesly_chen earned 500 total points
ID: 13654932
> # 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
 
LVL 3

Expert Comment

by:Mike R.
ID: 13829956
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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question