UrbanPro

Learn Linux from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

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

I am having 5+ years exp in civil engineering now I am thinking to move in IT sector can u suggest me which field is better to learn ? I am thinking to do Linux+devops+aws or powerBi 

Hi Waseem, I am a Devops and cloud engineed since last approximatelt 4 years.Linux,DevOps (techniques and tools) and Cloud, all are very much intera-related. DevOps and Cloud both are burning needs in...
Waseem
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...
Rajasubramanian

I am working as Tech support executive with windows and Linux total of 4 years of experience , Not getting enough calls / opportunities ... Which domain is good for change Sap basis consultant / any other suggestions are welcome

Learn Cloud Computing(Microsoft Azure,AWS,Google Cloud) or Devops. Make your career in this field. Your previous experience will use in this field.
Vamshi
My name is Rajesh , working as a Recruiter from past 6 years and thought to change my career into software (development / admin/ testing ) am seeking for some suggestion which technology I need to learn ? Any job after training ? Or where I can get job within 3 months after finishing my training programme- your advices are highly appreciated
Mr rajesh if you want to enter in to software Choose SAP BW AND SAP HANA because BW and HANA rules the all other erp tools next 50 years.it provides rubust reporting tools for quicker decesion of business It very easy to learn
Rajesh
1 0
6

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

Ask a Question

Related Lessons

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...

Linux File System
Linux File system: Right click on Desktop and click open interminal Login to Linux system and run simple commands: Check present Working Directory: $pwd /home/cloudera/Desktop Change Directory: $cd...

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...

Introduction to Programming Languages
What is a Programming Language? A programming language is a formal computer language or constructed language designed to communicate instructions to a machine, particularly a computer. Programming languages...

LINUX - SETTING UP YUM REPOSITORY
If we buy RHEL 7 the system by default will be connected to Red Hat Network (RHN). All packages and updates will be installed from RHN. So RHN will be our main source and repository. Since we have...
A

Aseem .

1 0
0

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
X

Looking for Linux Classes?

The best tutors for Linux Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Linux with the Best Tutors

The best Tutors for Linux Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more