How do I write a C program to emulate the Unix LS-L command?

Asked by Last Modified  

Follow 1
Answer

Please enter your answer

#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <stdlib.h> int main() { int pid; //process id pid = fork(); //create another process if ( pid < 0 ) { //fail printf(“\nFork...
read more
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <stdlib.h> int main() { int pid; //process id pid = fork(); //create another process if ( pid < 0 ) { //fail printf(“\nFork failed\n”); exit (-1); } else if ( pid == 0 ) { //child execlp ( “/bin/ls”, “ls”, “-l”, NULL ); //execute ls } else { //parent wait (NULL); //wait for child printf(“\nchild complete\n”); exit (0); } } read less
Comments

#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <stdlib.h> int main() { int pid; //process id pid = fork(); //create another process if ( pid < 0 ) { //fail printf(“\nFork...
read more
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <stdlib.h> int main() { int pid; //process id pid = fork(); //create another process if ( pid < 0 ) { //fail printf(“\nFork failed\n”); exit (-1); } else if ( pid == 0 ) { //child execlp ( “/bin/ls”, “ls”, “-l”, NULL ); //execute ls } else { //parent wait (NULL); //wait for child printf(“\nchild complete\n”); exit (0); } } read less
Comments

Related Questions

Hi my name is Raja i have 8 Years Expnt in Desktop Support i Need to change my Platform From linux basic are Network Base Work
Hi Raja, As you said, you already have some experience on desktop support, so better choose Linux Administration. First learn basic level of Linux Administration from any institute, then go to real time...
Profile Photo
Rajasubramanian
What is the cost of linux course and how much do the certification cost?
1000 for basic and 2000 for linux advance, for certification, give exam, clear it and you are certified
Profile Photo
Anusha
Which is the best book for the reference of Linux?
Linux: The Complete Reference
Profile Photo
Aneeshwara

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Linux Introdution
Linux is a UNIX-base operating system. Its original creator was a Finnish student name Linus Torvalds, although being ‘open source’ it has change a great deal since its original conception....
Profile Photo

How To Start Shell Scripting?
Hi learners, I would like to share my knowledge in shell scripting: Every new Linux learners goal is to learn shell scripting. But only a few starts quickly writing the shell scripts.Why? The reasons...
Profile Photo

how to learn linux system/server adminstration effectively
First the person looking to learn linux adminstration needs to strat from the basic and should practise everyday for atleast 2 hours a day
Profile Photo

Be prepared to get trained--init
Before starting the training,students must be mentally prepared for acceptance of new knowledge. Students must attend training with open minded forgetting the position they are working.This will help...
S

Smartnub Softsolutions

0 0
View Comments0

How to detect duplicate address manually in a network from Linux ?
Below script will help you to detect duplicate IP address in a subnet The key command is the arping command which will send out an ARP packet with DAD (duplicate address detection) If the return...
Profile Photo

Recommended Articles

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Looking for Linux Training?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you