Whenever you start a new process in Linux it creates a file in /proc/ folder with the same name as that of the process id of the process. In that folder, there is a file named “status” which has all the details of the process. We can get those Process Information Through shell as follows:
cat /proc/1/status

As can be seen, it displays most of the information about the process.
Note:, In this case, the process id is 1, it may be changed as per need.
You can get the System Information through the shell. The basic system information is stored in a file named os-release in /etc/ folder.
cat /etc/os-release

You can also get the System Information using C programming. The below code is used to get the details of the system. In this code, utsname maintains a structure that has the details of the system like sysname nodename, release, version, etc.
#include<stdio.h> #include<stdlib.h> #include<errno.h> #include<sys/utsname.h> int main() { struct utsname buf1; errno =0; if(uname(&buf1;)!=0) { perror("uname doesn't return 0, so there is an error"); exit(EXIT_FAILURE); } printf("System Name = %s\n", buf1.sysname); printf("Node Name = %s\n", buf1.nodename); printf("Version = %s\n", buf1.version); printf("Release = %s\n", buf1.release); printf("Machine = %s\n", buf1.machine); } |
On execution the above code will give the following output:

To get Process Information using C programming, use the below code. In this code, we execute the Linux command through a c program to get the details of the process.
#include<stdio.h> #include<stdlib.h> int main() { int r=system("cat /proc/1/status"); } |
On execution the above code will give the following output:

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- Introduction to Linux Shell and Shell Scripting
- Difference Between Single and Double Quotes in Shell Script and Linux
- How to check if a directory or a file exists in system or not using Shell Scripting?
- Kali Linux - Terminal and Shell
- How to find time taken by a command/program on Linux Shell?
- Making your own Linux Shell in C
- A Shell program To Find The GCD | Linux
- Developing a Linux based shell
- Basic Shell Commands in Linux
- How to Install Z Shell(zsh) on Linux?
- RANDOM Shell Variable in Linux with Examples
- Reverse a String | Shell Programming
- Kali Linux - Information Gathering Tools
- Linux - Network Information Service
- Create n-child process from same parent process using fork() in C
- Array Basics Shell Scripting | Set 2 (Using Loops)
- Implementing Directory Management using Shell Script
- Create a password generator using shell scripting
- Automated Recursive Encryption in a Directory Using Shell Script
- Process states and Transitions in a UNIX Process
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

