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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:20:42+00:00 2026-06-15T05:20:42+00:00

I want to retrieve some process info from /proc directory and my question is

  • 0

I want to retrieve some process info from /proc directory and my question is the following: is there a standart format for files in /proc/PID?
For example, there is this proc/PID/status file with Name:'\t'ProcName in its first line. Can I meet this file elsewhere with a whitespace instead of \t or smth like that?

  • 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-15T05:20:44+00:00Added an answer on June 15, 2026 at 5:20 am

    First of all, the documentation on /proc in Linux is provided in the Linux sources, in Documentation/filesystems/proc.txt. That should be the first place you look into if going to work with procfs. Sadly, AFAICS it doesn’t mention the exact record format.

    The second place to look is procps sources (that is, the package which provides ps tool). There you can find:

    colon = strchr(S, ':');
    if(unlikely(!colon)) break;
    if(unlikely(colon[1]!='\t')) break;
    

    which means that ps relies on the :\t being there. Therefore, you can assume that all current Linux kernels use this format. Moreover, I doubt that minor changes (like replacing the \t with something else) would be considered important enough to break compatibility with the old versions of ps tool.

    That said, you can usually be more liberal in what you accept. Considering the specific contents of that file, you can assume the colon being field separator, and strip any whitespace following it. If you are using shell script, the regular field separation should suffice.

    Lastly, I’d like to make a few points:

    1. The status file is supposed to be human-readable. Therefore, programs are usually better reading the stat file instead which is designed to be machine-oriented.
    2. I am considering Linux here only (based on tags). Different systems may have a bit different /proc format.
    3. If you are writing a C program (the shell tag was added by an editor), you should consider using the libprocps library which comes with procps instead of reading the files by hand. That way, you avoid re-inventing the wheel and relying on a specific format directly.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to serialize some information I retrieve from the user in a small
I want to retrieve some performance counters for the 'ASP.NET Applications' category from within
My app is calling a web service to retrieve some data, and I want
I store some dates in my NSMutableArray, I want to retrieve them and change
I am using mysql and facing some problem. I want to retrieve last row
I want to count the number of transactions which retrieves some reports from database
I want to start several threads, retrive data from net, perform some actions with
I have a HTML table as follows. I want retrieve row values from this
Is there a way to generically retrieve process stats using Perl or Python? We
I have a simple MVC3 application that I want to retrieve some configuration details

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.