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.
Distribution: Ubuntu, Debian, Various using VMWare
Pretty much anything can be scripted.
For information on the commands you listed, check the man pages.
I would suggest that you learn to write bash scripts first, and then start trying to script those commands. Since they are tools that actually modify your disk partitions, there is the potential for you to lose data if you don't know what you are doing.
Something I discovered recently is that you can write scripts in Python too. I find Python way more intuitive and you can really do anything with it. Most distributions come with Python apparently; it's powerful, about the easiest language I've ever learned and isn't arcane like bash can be at times.
Well, so far, I haven't managed to script "ignore the pointless questions in LQ" (but then I'm not really trying, s'pose).
but don't expect--for example--to do a lot of math. Bash is klutzy with simple arithmetic and does not do floating point--much less any trig or other stuff.
Well, bash itself can't really do fp/transcendentals, but you can always push the numbers through bc/dc or something (I think there is another one whose name I've forgotten). And I'm sure that you can force, say, awk (or emacs) to do math of idiotic complexity, if you really want to (but I don't).
Although by that point, I've usually got to the point that I think that something like Python would be a better idea.
Just to point out, if you need to do floating-point calculations in a shell script you can use bc. Example:
matt@debian:~$ echo "scale=10; 1 / 3" | bc
I believe you can do pretty much everything (within reason) with shell scripting, the reason being is that there are so many amazing utilities at your disposal (ie bc). I think the biggest draw back would be portability and maybe performance.
One of the very nicest features of Unix is the so-called "shebang." If you look at many programs, you'll discover that it is actually a text file, a script of some kind, which begins with a line such as:
The essential idea here is that, when the file begins with ("#!") shebang, that's the name of the program that should be invoked .. invisibly to you .. to run this program.
This is the pathname to a program, such as Perl in this case; it can also be a more-generic ("computer, you go find it for me...") type of reference.
So... what this allows you to do is to quickly and easily write programs in script-languages: pick one. In the Unix/Linux environment, you can more-or-less count on Perl, Python, and PHP; and probably Ruby. All four of these are high powered, fully-featured programming languages with very excellent implementations.
The command-interpreter (most-frequently bash, but as-usual "you have many choices") also has its own built-in scripting capabilities, up to a point. This may be why all command-line scripting is often colloquially referred-to as "bash scripting." But you are not limited-to that scripting capability, which in my mind is appropriate only for the simplest stitching of things together. No matter what language you use, the end-results are indistinguishable.