Linux/UNIX admin {programm, script}ing knowledge
hiddenknight821
Member Posts: 1,209 ■■■■■■□□□□
in Off-Topic
Not sure where to post this since this isn't quite Linux+, Red Hat, or LPIC specific but hope to garner more response here.
Since I'm on the road to become a Linux administrator, I'd like to know which languages I should be proficient in.
I did some researches, and I just learned Perl and Python can be used as scripting languages but are actually high-level programming languages. I was convinced Perl was just a scripting language that's installed natively on most Linux distro nowadays.
From my finding, I draw to a conclusion that admins must knows bash, sed, and awk (symbolic link to gawk for Linux distro). However, when a situation arises where higher-level programming is needed for better granular controls, one must knows either Perl or Python.
I'd rather learn the languages that has the packages installed on most minimally-installed Linux/UNIX systems. Can someone (preferably Linux/UNIX admins) please chime in and let me know if I'm on the right track?
1) bash
2) sed & awk
3) perl (since it's similar to awk}
4) python (might even consider becoming a developer several years later)
Since I'm on the road to become a Linux administrator, I'd like to know which languages I should be proficient in.
I did some researches, and I just learned Perl and Python can be used as scripting languages but are actually high-level programming languages. I was convinced Perl was just a scripting language that's installed natively on most Linux distro nowadays.
From my finding, I draw to a conclusion that admins must knows bash, sed, and awk (symbolic link to gawk for Linux distro). However, when a situation arises where higher-level programming is needed for better granular controls, one must knows either Perl or Python.
I'd rather learn the languages that has the packages installed on most minimally-installed Linux/UNIX systems. Can someone (preferably Linux/UNIX admins) please chime in and let me know if I'm on the right track?
1) bash
2) sed & awk
3) perl (since it's similar to awk}
4) python (might even consider becoming a developer several years later)
Comments
-
lsud00d Member Posts: 1,571Here's my take neigh perl and python because those are on my to-do list and I'm only at early stages with them, but
awk is immensely powerful in small scripts and sed (stream editor) can do a lot of things. I mainly use them (in combination with grep, tr, cut, etc) for log parsing for creating variables and/or text output. I then use these variables in loops and trigger actions based on log entries.
This is my favorite awk tutorial:
Awk - A Tutorial and Introduction - by Bruce Barnett
This is my favorite sed page:
http://www.catonmat.net/blog/wp-content/uploads/2008/09/sed1line.txt
Also what's awesome about perl and python is that they are OS portable/agnostic so they are very good to learn for scripting in general. Python is on my list first, then perl. -
W Stewart Member Posts: 794 ■■■■□□□□□□I'd say that's a pretty good list. I see every now and then jobs asking for a linux/unix admin who knows how to program in C but for the most part bash, perl and python should be enough. I have yet to get around to learning python yet but perl is awesome.
-
pram Member Posts: 171In my experience I've found perl and expect to be the most useful languages for admin tasks. I'd say you absolutely need to know how to use sed, but awk is only useful for menial formatting. Perl was designed to replace awk and it handles pretty much every task you'd use awk for in a more straightforward way. The same could be said for python as well, which has a great csv module. It is of course possible to use awk as a general scripting language, but you're missing out on a lot of fantastic perl/python modules which simplify things tremendously. In addition, I find awk's syntax to be very terse and inscrutable most of the time (but the same could be said for perl heh)
So really, don't think of perl and python as 'higher-level.' They can be used for the exact same things bash and awk would be used for.
There are of course times when a bash script is the best option, and it's generally when you're chaining a lot of commands together for automation via a cron job or something similar. Bash is incredibly easy to learn though, you pretty much just need to understand if/else/elif/while/do
Also take a look at expect/autoexpect, it's invaluable for throwing something quick and dirty together. Expect goes well with bash if you need to do something repetitive, especially in a situation where you need to (for example) log onto 100 servers and install something.
autoexpect(1) - Linux man page -
pram Member Posts: 171In addition I'd say focus on learning either perl or python to begin with. Once you understand one, you'll have little issue understanding the other. For admin tasks theres no point learning both anyway, since you'll be able to accomplish everything with one or the other.
For tasks beyond administration I'd say learn python, if only because Django uses it. Theres no comparable web framework for perl that is as ubiquitous.
Heres the big gotcha though: Perl is installed on practically every crufty unix (AIX, Solaris, etc) while Python might not come with the default installation. It's becoming more common for sure, but it can still be an issue on older installations. -
dontstop Member Posts: 579 ■■■■□□□□□□I would recommend you read the following first
http://www.amazon.com/Linux-System-Administration-Handbook-Edition/dp/0131480057/ref=sr_1_1?ie=UTF8&qid=1361011154&sr=8-1&keywords=system+administrator+linux
&
Amazon.com: The Practice of System and Network Administration, Second Edition (9780321492661): Thomas Limoncelli, Christina Hogan, Strata Chalup: Books
These books will give you enough knowledge to answer your own question accurately for what type of *nix Admin you wish to become. -
log32 Users Awaiting Email Confirmation Posts: 217For almost any Linux Administration job, bash is a must, and yes it is very easy to learn once you get the idea of:
if then else, while, for loop, case esac, select in addition with awk & sed.
you could however learn Python (which is almost never a demand, but an advantage in term of job descriptions) and I found this book to be VERY useful since it aims to teach you Python from the system administration POV
Python for Unix and Linux System Administration Noah Gift Jeremy Jones Excell 0596515820 | eBay
good luck. -
hiddenknight821 Member Posts: 1,209 ■■■■■■□□□□Thanks everyone. You rock for showing some *nix loves.
So, I'm on the right track after all. Can't wait to dig deeper into the scripting world after I'm done with the Linux Administration book and before I move to Michael Jang's. I'll be using mostly O'Reilly books for the languages.
@pram Thanks. I have yet to use the expect/autoexpect command. I hope to run into it at some points in the next several books.
@dontstop The first book you suggested is definitely on my wishlist. I just can't get my hand on it yet until I'm done catching up with the books I'm suppose to be reading. By the way, I wasn't aware there are many types of *nix admin, but it's too soon for me to make a decision until I get my foot in the door as system administrator.
@log32 That's on my long reading list as well. Hopefully I'm still interested in learning Python after Perl.