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.
Say a person is working towards becoming a Redhat Systems Administrator/Engineer, and as required/advertised for many jobs in this role, needs the abiltiy to write scripts for administrative purposes.
Which language would be the best to learn (first) bash/perl/python .
I have seen advice that suggested it might be better to learn python rather than bash.
If the role were to cover web administration, then perl or php would also be required. Could learning perl cover both system and web administration purposes.
Yes perl would be a good one to learn but I still feel bash would be a really great first scripting language to use. This is do to much of your system using bash scripts. IE startup and Shutdown scripts, and some in your /sbin are nothing more than bash scripts. So I am going to Say go bash first then look at what is needed in your area. In my area I hear bash / perl and or php.
I've been increasingly responsible for administering Linux machines for a living for about six years. I don't know Python. Perl I've only start fiddling with in the last couple of days because I need a script to parse XML and bash is no good for that. I can handle PHP but have never used it for any sort of admin purpose, only for web content generation and then nothing to do with my job. What I use at work every single day is bash. The Linux machines I look after contain a bunch of useful scripts users can use to achieve various things from setting up Thunderbird for use with our email system with a few mouse clicks to resetting their KDE settings back to the defaults and they're all bash scripts. bash is what you have when you're at a command prompt so it really is the one to start with. You can do a lot of stuff simply by piping the output of one command in to another (then that in to another, to another and to another if needed). You can easily give your scripts a simple GUI interface using programs like kdialog.
in regards to piping output using bash, you then have to have working knowledge of 'sed' and '(g)awk' (assuming you need any type of string manipulation beyond the capability of bash variable substitution methods) Knowing 'bash' simply isn't enough. You have to know the basic programs available to you (which I'm sure you will find out all the details of with any type of training manual/course). Most definitely, learn bash's variable substitution methods before touching sed and gawk. You can avoid using either of those in some cases.
Definitely learn bash, its the cmd line default. Also at least the basics of sed/awk or have a good ref handy.
For more powerful stuff, Perl is very popular. There's even an O'Reilly book 'Perl for System Administration' http://oreilly.com/catalog/9781565926097/
You can also do web content with Perl, or use php.
There are various things that you might want, but you will need at least simple bash scripting.
You could say I'm prejudiced because I like Python, but, irrespective of that, I think in your situation, you should learn at the very least some basic bash first. There are some circumstances in which bash (plus sed, grep, awk, as mentioned earlier) is the only reasonable solution for a sys admin, so really the question is, what to do after that; "advanced" bash, Perl or Python? You'll get people arguing for each and none of them is bad. Maybe you'll have developed your own preference by then.
I agree that bash is essential to any system administration task. It is the natural extension of the command line you use all the time, and uses all the same constructs, commands and environments. So start there.
However, if you want to massage text, don't waste your time with sed and awk. They are too "awk"ward, hard to learn, limited, etc. Perl is easier to learn and use, and far more powerful, and the available library packages lend themselves to solving lots of problems that sed/awk never could. Perl uses all of the "regular expression" power of sed and awk, and then some, but goes far beyond them. I use either bash or perl almost all the time for any system administration job.
Perl follows very closely and further enables the Unix "tool" philosophy of small tools that can be piped together to accomplish bigger jobs, operating on standard text data in the pipeline, as sed and awk do. But it adds much more flexibility and power.