Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, I have a few installations of MailScanner which I have done over several months. I know MailScanner is running, and can it see it appear using 'top' whenever someone ...
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    15

    How to see the location of a program currently running?

    Hi,
    I have a few installations of MailScanner which I have done over several months. I know MailScanner is running, and can it see it appear using 'top' whenever someone sends an email, but how do I find out exactly *which* MailScanner installation it is running?
    e.g. if I have one MailScanner installed at /directory1 and another MailScanner installed at /directory2 then how do I see which one is actually appearing in 'top'.
    This is probably a rather basic/dumb question so apologies...

  2. #2
    Linux Newbie
    Join Date
    Nov 2007
    Location
    Planet Earth
    Posts
    152
    You can use the /proc filesystem like this:
    Code:
    cat /proc/[the_pid_of_your_program]/cmdline
    Of course, [the_pid_of_your_program] can be obtainer from top or ps.

    Another option is:

    Code:
    head -1 /proc/[the_pid_of_your_program]/maps
    Hugo
    EOF

  3. #3
    Just Joined! sathiya's Avatar
    Join Date
    Feb 2008
    Location
    Bangalore, India
    Posts
    97

    top command

    while seeing the top command, press "c" .. it will display the path...


    is it showing ??? reply us..

  4. #4
    Just Joined!
    Join Date
    Feb 2008
    Posts
    15
    Sathiya: thanks for the info about 'top' - pressing 'c' shows more info for most processes running but when it comes to MailScanner it still doesn't show the path. Instead it shows things like "Mailscanner: waiting for messages" and "Mailscanner: checking with SpamAssassin".

    Hugo: using cat /proc/[the_pid_of_your_program]/cmdline shows the same messages as above.
    The 'head' command, for some reason, shows:
    08048000-08148000 r-xp 00000000 08:05 1737038 /usr/bin/perl

    Cheers

  5. #5
    Just Joined!
    Join Date
    Feb 2008
    Posts
    18
    Just to mention it: there is a command "which" .
    --Japser.

  6. #6
    Linux Newbie
    Join Date
    Nov 2007
    Location
    Planet Earth
    Posts
    152
    Quote Originally Posted by chuckee View Post
    Hugo: using cat /proc/[the_pid_of_your_program]/cmdline shows the same messages as above.
    The 'head' command, for some reason, shows:
    08048000-08148000 r-xp 00000000 08:05 1737038 /usr/bin/perl
    That's because your program is a perl script, and the *real* program is /usr/bin/perl just using a file with the script... maybe using:

    Code:
    sudo lsof | grep perl
    helps to find the exact script file that perl is running.

    Hugo
    EOF

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •