implement ps command in linux using C
This tutorial is to help you to implement ps command in linux using C.
ps command provides the list of all the currently running processes in the system.
ps command is also one of the most useful bash command
and is implemented in various ways.
It can help us to see the list of all- info about the threads
- security information
- each process running as the root.
- processes with their particular PIDs
For eg, open up the terminal and write the command
root@kali:~# ps -e
It will print all the currently running processes.
So let's implement ps command using C
Below is the simple C code to pace up our learning process
#include<stdio.h>
#include<stdlib.h>
void main()
{
printf("It'll print all the currently running processes");
system("ps -e");
}
system is the C library function to excute the bash command
I've saved it by named pscommand.c on Desktop
the output is shown to you by the next screenshot.
how to compile c program in linux
Let use our ps command more briefly in C.
Here is another C code to implement ps command.
#include<stdio.h>
#include<unistd.h>
void main()
{
printf("It'll print all the currently running processes in the long format\n");
execl("/bash/ps","ps","-el",NULL);
}
- execl executes list of command line arguments. Last parameter is end of argument and always be NULL
- -l in ps is used to print the data in long format
- I've saved this file with name pscommand2.c on my desktop
So guys, it is all about to implement ps command in linux using C.
Remember, there is no end to this.
So just go deeper and deeper and learn more.
I remember my experience with hackers i contacted online, i almost lost hope in finding out if my husband was loyal to me and has been loyal in our 20 years marriage,I lost a lot of funds in paying these so called hackers so i made up my mind that if i get scammed again i'll just forget about finding out what God doesn't want me to know, Then i saw reviews about ( HACKINTECHNOLOGY@GMAIL.COM ) and decided contact him and if and if i hear any stupid excuse won't contact anybody and just accept that God doesn't want me to then he proved to me that he isn't a cheat by working a sample job for me but to my greatest surprise he did the job and sent results to me fast, i was so happy but sad part was i divorced my husband, and i will drop an advise for people who wants any kind of hacking services stopped being scammed by people who impersonate being hackers, (ETHICALHACKERS009@GMAIL.COM) for a fast and clean job.Here is his cell number +1 (669) 225 2253 , Thank me later.
ReplyDeleteHello guys, I just want to share my joyful experience about HACK VANISH CREDIT SPECIALIST. Before the coronavirus pandemic, I had criminal Judgments, few evictions, and late payment which negatively impacted my credit score down to 487 and left me in difficult financial situation, as a single mum of 3, I needed a loan to keep the family running after I lost my husband as a result of COVID-19, all hope were lost, until Mrs. Olivia referred me to HACK VANISH, a credit genius who was very helpful in fixing my credit 6 days after I reached out to him via Email: hackvanish (At) gmail (Dot) com and Phone: +1(747) 293-8514, throughout the process, I felt so involved because an open line of communication was maintained till I got my FICO score restored to 796, currently my loan application has been approved. If you need to hire a credible hacker, HACK VANISH is highly recommended.
ReplyDelete