Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Is there a function that i can use to tar a particular directory? I need the function that i can use in my code and not from command line. Any response will be very highly appreciated since i am kinda stuck and nearing deadlines
Well, i know that about "man tar" from the command line. It would have been nicer if you read the whole question rather than implying that i am lazy. Well anyway, keeping it professional, what i meant was since i am new to unix, i wanted to ask for a way to INVOKE the tar function from the code, like using some system calls.
In perl, we can call any command using backquote.
for example :
`tar -zvxf hello.tar.gz`
I am not sure but in "sed", you can also call any command like above. As chris said, there are many languages supporting system() function. You need to just discover what is similar function in the language you are using
Actually, backquotes make the cmd run, same as $(cmd) in shell, similar effect to system() in non-shell langs.
Assigning the results captures the output ...
exec is usually used with fork to create more copies of 'parent' process, although there are variations that overlay/replace parent process with new 'child' process.
An alternative to this is threads, if lang supports it eg C, Perl.