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 8046903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:56:16+00:00 2026-06-05T05:56:16+00:00

for instance, in bash when i type ps -wef I will get: UID PID

  • 0

for instance,

in bash when i type ps -wef I will get:

UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 20:06 ?        00:00:01 /sbin/init
root         2     0  0 20:06 ?        00:00:00 [kthreadd]
root         3     2  0 20:06 ?        00:00:00 [ksoftirqd/0]
root         6     2  0 20:06 ?        00:00:00 [migration/0]
root         7     2  0 20:06 ?        00:00:02 [watchdog/0]
root         8     2  0 20:06 ?        00:00:00 [cpuset]
root         9     2  0 20:06 ?        00:00:00 [khelper]
root        10     2  0 20:06 ?        00:00:00 [kdevtmpfs]
root        11     2  0 20:06 ?        00:00:00 [netns]
root        12     2  0 20:06 ?        00:00:00 [sync_supers]
root        13     2  0 20:06 ?        00:00:00 [bdi-default]
root        14     2  0 20:06 ?        00:00:00 [kintegrityd]
root        15     2  0 20:06 ?        00:00:00 [kblockd]
root        16     2  0 20:06 ?        00:00:00 [ata_sff]
root        17     2  0 20:06 ?        00:00:00 [khubd]
root        18     2  0 20:06 ?        00:00:00 [md]
root        21     2  0 20:06 ?        00:00:00 [khungtaskd]

and I know which column i want to keep, for example i want to keep the second column which is the PID column, the final result will be:

1 2 3 6 7 8 9 10 11 12 13 14 15 16 17 18 21

the first line of the original result of ps will be deleted.

How can I use sed or awk to get my final result?

Thank you.

  • 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-06-05T05:56:18+00:00Added an answer on June 5, 2026 at 5:56 am
     ps -wef | awk 'NR>1 {printf("%s ", $2)}END{printf("\n")'
    

    I hope this helps.,

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

Sidebar

Related Questions

I have a piece of code that invokes an instance of the bash terminal
In Bash, I want to get the Nth word of a string hold by
How i can delete whitespace in each line of file, using bash For instance,
I'm trying to use bash string operators on a constant string. For instance, you
On a fresh Rackspace instance, I try installing RVM with this: bash -s stable
I'm a long-time csh user trying (painfully) to convert to bash. My apologies if
Problem: I want to be able to run a bash instance from my cocoa
How can I get the directory a bash script file is in, when that
I'm trying to get the download link of wordpress' plugins via bash script directly
Is there a way to expand a bash alias on the command-line and get

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.