Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7526563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:51:57+00:00 2026-05-30T03:51:57+00:00

I am trying to get the pid of this command. sudo -b tcpdump -i

  • 0

I am trying to get the pid of this command.

sudo -b tcpdump -i eth0 port 80 -w eth0.pcap
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:51:59+00:00Added an answer on May 30, 2026 at 3:51 am

    You can use $! to get the pid of the last background process (which will be the sudo in this case), and ps --ppid to find out about its children. So for example:

    $ sudo tcpdump -i eth0 port 80 -w eth0.pcap &
    $ ps --ppid $! -o pid=
    16772
    $ ps --pid 16772
      PID TTY          TIME CMD
    16772 pts/3    00:00:00 tcpdump
    

    If you’re doing this in a script, you might want to use a sleep 1 between the sudo and ps to ensure that the child gets started.

    Note that if you really must use the -b flag to sudo, this won’t work, as that will cause sudo to do an extra fork and immediately exit, losing the connection between child and parent (the tcpdump command will get reparented to init), which means you’ll have no easy way of distinguishing the child from any other similar command.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to mount a device and get the pid of mount command. cmd="/bin/mount /dev/sda1
I'm trying to run a java (jnlp) applet from bash and get the PID
Trying to get this expression to work, can someone look at it and tell
I'm trying to get the Pid of my application under Ubuntu with the following
I'm trying to get the stack backtrace of a running process (PID and binary
I currently am starting a Java process, and am trying to get its PID
I am trying to use the ps -o command to get just specific info
I am trying to get process path by pid but I'm getting Win32Exception (access
So i am trying get 2 div-containers which both should contain centered text (Both
I'm trying get the visible portion of UIImage from an UIImageView . UIImageView takes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.