views:

329

answers:

9

Hello, I'm currently studying to become a Networks/Systems administrator, and I would like to know what language do you recommend me to learn/improve that could be useful in my career ?

I know Java it a lot used in enterprise as Application Servers (J2EE and co), but I also know that Python is used as script and some server-side scripting (and why not some light client-side applications)

I know a little of both (I created some Nagios plugins with Python, some Django apps too, and with Java I never really created something in production, I just tested Grails which is great (as Django is))

For you, which one is the more useful for this career ?

Thank you

+8  A: 

Python has -- via the os module -- numerous direct Linux OS API's implemented. Java doesn't have as direct access to OS API's.

S.Lott
The os module is a very good point - I love the way Python can be so high-level but still able to drop right down for the important stuff.
Skilldrick
+4  A: 

Though this might be good to ask on http://superuser.com/ or http://serverfault.com/

My own 2 cents are "python" and "perl", for use specifically as a sysadmin or networks person.

If you are maintaining lots of legacy things, several scripts (bash, ksh, csh, tcsh) and "awk" and "sed" may come in handy, too.

eruciform
Or ServerFault (http://serverfault.com)
Ophidian
@ophidian: yep, cut-and-paste failed me before i hit save :-)
eruciform
It's both related to programming and system administration, I don't really know where I had to ask..
Kedare
@Kedare understandable. I think you'll get better feedback on SF simply because these are the people with front line experience that can give you first hand info.
Ophidian
being a `C` nerd myself, I recommend it as the basis of all programming that is not scripting or OOP -- and even with the latter, most OOP languages base some of their syntax on C
eruciform
Ophidian: Is there a way to move the topic on ServerFault or do I have to repost it ?
Kedare
@Kedare - The only problem with asking on SF is that there aren't as many people there. I don't think there's a problem with cross-posting questions like this.
Skilldrick
+11  A: 

I'd say definitely Python - you can use it in place of bash scripts to automate a lot of what you'll be doing daily. Java's too heavyweight for that kind of thing.

Skilldrick
I would also learn bash, as many of the tools you'll be dealing with still use it.
qor72
@qor72 Yup - I'm doing a lot of Linux at the moment and you can't just replace all the bash with Python, so it's probably an essential skill.
Skilldrick
+1  A: 

Why not both? For me Python is the most useful, but knowing Java comes in handy a lot.

Zonda333
It's not easy to learn 2 languages at the same time, I would prefer to learn one first ;)
Kedare
+2  A: 

For system-administration, I'd definitely learn Python.

Java executes faster in general and I think it uses less memory, but for the most part a system administrator shouldn't be writing anything where those differences matter (most of the time your programs will be waiting for the hard drive).

Python has the huge advantage that programs are really easy to write, and the more time you spend with Python, the more crazy things you learn about it.

Here's an interesting comparision of the languages (fairly old, but I didn't see anything horrible in it).

Note that the Python code is much shorter and (once you learn Python) easier to read too.

Brendan Long
Sort of wondering why someone voted this down?
Brendan Long
Just for starters Java isn't faster than Python and Java uses way more memory for the same task ...
fuzzy lollipop
@fuzzy lollipop, the memory difference depends on the situation, but Java is almost always significantly faster. You can use tools like numpy to narrow the gap, but there's a reason things like that were created.
Brendan Long
why would a system adminstrator need to use numpy? For system admin tasks that don't require tight Java interaction with some 3rd party library Python will always be a better choice.
fuzzy lollipop
@fuzzy lolipop, you may have noticed that I said "definitely learn Python": As in, the speed difference doesn't matter. Try reading entire answers before complaining. Or even the first sentence maybe.
Brendan Long
my issue is the inaccurate information you are providing about Java, read for comprehension, you throw out numpy as a unrelated performance enhancement, my point is numpy is __irrelevant__ to the topic
fuzzy lollipop
@fuzzy lollipop, my point is that Python is objectively slower for most tasks. Numpy is a way to fix this, but it's hardly necessary for sysadmin tasks, as you'll note from my answer: "for the most part a system administrator shouldn't be writing anything where those differences matter (most of the time your programs will be waiting for the hard drive)."
Brendan Long
explain how numpy has anything to do with system administrative type scripts? and show proof that Java is empirically "faster" than Python in system administrative tasks. And the startup time of the JVM will KILL any minor performance improvement Java may have over a similar Python program.
fuzzy lollipop
@fuzzy lollipop: "Numpy is a way to fix this, <b>but it's hardly necessary for sysadmin tasks</b>". Troll harder?
Brendan Long
Brendan Long
Also, numpy was an example of how to make Python faster if you need to, but I DON'T THINK A SYSADMIN NEEDS IT. Is that clear enough?
Brendan Long
+2  A: 

On the administrative side, you're likely to find Python (or perl) much more useful.

Most administrative tools and scripts that you'll want to be able to poke at will be written in it. Especially on Linux you have closer system access and many of its existing administrative tools are written in Python. Because of this, you're significantly more likely to run into a machine with just Python rather than one with Java installed.

Ophidian
+2  A: 

I would choose Python but if you really need to use Java libraries for some reason I would suggest Groovy instead of Java. It looks a lot like Python, has all the benefits of Java ( and the drawbacks of deployment and .jar dependencies ). I use Python almost exclusively for system automation work, but if I need to do something that interacts with some Java library and a simple script is appropriate, I reach for Groovy.

fuzzy lollipop
Hmm, I think I'll choose both Java/Groovy and Python, I find Java really great for all the server functions (JMX, JVM Monitoring, and all the J2EE stack) but it lacks some low level features (ex: manipulation of file permissions), so here I think python should be better for administration script (and also faster to start)
Kedare
+2  A: 

As a sysadmin, you probably won't have any reason to write Java apps. But you should definitely learn about Java containers, like Tomcat.

I don't know Python, but I've heard good things about it. Ruby is another scripting language that's worth considering. But before you get into those, you should make sure you know Bash, since there's already a huge number of existing Bash scripts on most Unix installations.

Mike Baranczak
The problem with Ruby is when you get away from Rails there is... nothing...
Kedare
+2  A: 

Definitely Python. Have a look at iterpipes to go out of the hell of bash exception handling.

kriss
but if you plan to be sysadmin you should also learn Perl. It makes awk, sed and many other alike tools totally useless.
kriss