Getting System and Process Information Using C Programming and Shell in Linux Last Updated : 17 May, 2020 Comments Improve Suggest changes Like Article Like Report 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. C #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. C #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: Comment More infoAdvertise with us M manav014 Follow Improve Article Tags : Linux-Unix Explore Linux/Unix Tutorial 10 min read Getting Started with LinuxWhat is Linux Operating System 10 min read LINUX Full Form - Lovable Intellect Not Using XP 2 min read Difference between Linux and Windows 7 min read What are Linux Distributions ? 8 min read Difference between Unix and Linux 5 min read Installation with LinuxHow to Install Arch Linux in VirtualBox? 7 min read Fedora Linux Operating System 12 min read How to install Ubuntu on VirtualBox? 6 min read How to Install Linux Mint? 3 min read How to Install Kali Linux on Windows? 2 min read How to Install Linux on Windows PowerShell Subsystem? 2 min read How to Find openSUSE Linux Version? 2 min read How to Install CentOS 2 min read Linux CommandsLinux Commands 15+ min read Essential Unix Commands 7 min read How to Find a File in Linux | Find Command 9 min read Linux File SystemLinux File System 12 min read Linux File Hierarchy Structure 6 min read Linux Directory Structure 6 min read Linux KernelLinux Kernel 4 min read Kernel in Operating System 9 min read How Linux Kernel Boots? 11 min read Difference between Operating System and Kernel 3 min read Linux Kernel Module Programming: Hello World Program 7 min read Linux Loadable Kernel Module 7 min read Loadable Kernel Module - Linux Device Driver Development 4 min read Linux Networking ToolsNetwork configuration and troubleshooting commands in Linux 5 min read How to configure network interfaces in CentOS? 5 min read Command-Line Tools and Utilities For Network Management in Linux 8 min read Linux - Network Monitoring Tools 4 min read Linux ProcessProcesses in Linux/Unix 6 min read How to Manage Process in Linux 4 min read Getting System and Process Information Using C Programming and Shell in Linux 2 min read Process states and Transitions in a UNIX Process 4 min read Linux FirewallLINUX Firewall 7 min read iptables command in Linux with Examples 7 min read How to Configure your Linux Firewall - 3 Methods 12 min read Shell Scripting & Bash ScriptingIntroduction to Linux Shell and Shell Scripting 8 min read What is Terminal, Console, Shell and Kernel? 5 min read How to Create a Shell Script in linux 7 min read Shell Scripting - Different types of Variables 4 min read Bash Scripting - Introduction to Bash and Bash Scripting 12 min read Bash Script - Define Bash Variables and its types 12 min read Shell Scripting - Shell Variables 6 min read Bash Script - Difference between Bash Script and Shell Script 4 min read Shell Scripting - Difference between Korn Shell and Bash shell 3 min read Shell Scripting - Interactive and Non-Interactive Shell 3 min read Shell Script to Show the Difference Between echo â$SHELLâ and echo â$SHELLâ 4 min read Like