LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices

Reply
 
Search this Thread
Old 11-26-2008, 12:11 PM   #1
max_cherry
LQ Newbie
 
Registered: Oct 2008
Location: Sussex, UK
Distribution: fedora
Posts: 6

Rep: Reputation: 0
Which scripting language to learn


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.

Many thanks for any replies.
Max
 
Old 11-26-2008, 12:15 PM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,054

Rep: Reputation: 83
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.
 
Old 11-26-2008, 01:26 PM   #3
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: SLED, openSUSE
Posts: 1,022

Rep: Reputation: 173Reputation: 173
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.

Beginners Guide:
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
Advanced
http://tldp.org/LDP/abs/html/
 
Old 11-26-2008, 01:43 PM   #4
lumak
Member
 
Registered: Aug 2008
Location: Phoenix
Distribution: Arch
Posts: 799
Blog Entries: 32

Rep: Reputation: 109Reputation: 109
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.
 
Old 11-26-2008, 01:47 PM   #5
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: SLED, openSUSE
Posts: 1,022

Rep: Reputation: 173Reputation: 173
Good point about sed and (g)awk. The bash guides I linked do cover both of those to some degree.
 
Old 11-26-2008, 02:18 PM   #6
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,211

Rep: Reputation: 292Reputation: 292Reputation: 292
+1 for bash, sed and awk.
 
Old 11-26-2008, 06:46 PM   #7
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,280

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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.

Here's a few links:

http://rute.2038bug.com/index.html.gz
http://www.tldp.org/LDP/abs/html/
http://perldoc.perl.org/
http://www.perlmonks.org/?node=Tutorials

good luck
 
Old 11-27-2008, 05:04 AM   #8
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,903

Rep: Reputation: 775Reputation: 775Reputation: 775Reputation: 775Reputation: 775Reputation: 775Reputation: 775
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.
 
Old 11-27-2008, 09:29 AM   #9
max_cherry
LQ Newbie
 
Registered: Oct 2008
Location: Sussex, UK
Distribution: fedora
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks a lot Guys. This puts things completely into perspective. Very much appreciated.
 
Old 11-27-2008, 09:35 AM   #10
Fritz_Monroe
Member
 
Registered: Nov 2004
Location: Maryland, USA
Distribution: Mint 13
Posts: 272

Rep: Reputation: 30
I'll put my vote in for bash as well. There's so much admin work that can be accomplished with bash. Then when you are comfortable at least with the basics, move onto Perl or Python.
 
Old 11-27-2008, 12:04 PM   #11
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 718

Rep: Reputation: 72
Hi.

Any of the references cited for bash, and, if you want a smattering of many, with examples that you can enter and test:
Code:
Title: UNIX(R) Shells by Example
Subtitle: ... guide to the C, Bourne, and Korn Shells plus Awk, Sed, and Grep
Author: Ellie Quigley
Edition: 4th
Date: 2004
Publisher: Prentice-Hall
ISBN: 013147572X
Pages: 1200
Categories: sh, csh, ksh, grep, sed, awk, scripting, shell, programming
Comments: 4.5 stars, 50 reviews Amazon (2008.11)
Comments: ( I have 2nd Ed, 1997; 4th covers also bash )
Best wishes ... cheers, makyo
 
Old 11-27-2008, 12:47 PM   #12
mwarnock
LQ Newbie
 
Registered: May 2006
Posts: 1

Rep: Reputation: 0
One more for bash, but perl over sed/awk

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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the best programming language to learn jax8 Programming 25 04-04-2010 10:21 AM
What was your first language to learn? vashsna Programming 21 06-11-2007 07:04 PM
what language is best to learn io13 Programming 4 07-09-2006 09:17 AM
What Language Should I Learn? KungFuHamster General 45 04-25-2006 02:10 PM
Which C language to learn? Heiland Programming 10 08-14-2005 08:03 AM


All times are GMT -5. The time now is 07:05 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration