Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

How do I prevent the command/parameters in a system call from displaying in ps

by infoninja (Friar)
on May 24, 2000 at 20:09 UTC ( #14579=categorized question: print w/replies, xml ) Need Help??
Contributed by infoninja on May 24, 2000 at 20:09 UTC
Q&A  > programs and processes


I'm putting coding a perl program that needs to use system() a number of times. In a couple of the uses of system(), I need to, if possible, prevent a listing from appearing in the output of what shown if 'ps a' is run at the same time that the command in system() is running. Is there any way to do this in perl ?

Answer: How do I prevent the command/parameters in a system call from displaying in ps
contributed by comatose

No matter what, the command you are trying to run is going to show up in the process list. ps parses the /proc information and formats it nicely and will show everything running no matter what you might do in perl (assuming you don't use hacked versions of ps and top).

The only way to keep command arguments from showing is to use open() and pipe your arguments to it through STDIN. There might be some potential for obfuscation, but that's about it.

Please (register and) log in if you wish to add an answer

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (3)
    As of 2020-10-25 23:57 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (249 votes). Check out past polls.