LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   System administration - best scripting language to start out with? (https://www.linuxquestions.org/questions/linux-server-73/system-administration-best-scripting-language-to-start-out-with-4175635650/)

sabaton 08-04-2018 08:11 AM

System administration - best scripting language to start out with?
 
Hi,

This is a question to Linux system administrators from an aspiring sysadmin currently preparing for formal training in the field.

My question pertains to scripting languages. I'm mainly focusing on improving my Bash skills and the training will also involve PowerShell since it doesn't focus exclusively on Linux. They don't teach any of the "Big Three" - Python, Perl, and Ruby - which is why I'm thinking of learning one of them on my own. I've dabbled with all three.

That said, I'm a bit confused as to what scripting language other than Bash would make the best choice. Job vacancies for junior Linux system administrators usually mention the "Big Three" (apart from the ubiquitous Bash, of course) but rarely require knowledge of a specific scripting language. They simply either demand or prefer that you be familiar with at least one of the Big Three.

Which leads me to wonder which of those, in 2018, may be the best choice. I've dabbled with all three. I like Ruby and Perl most, although Python comes up somewhat more often than Perl or Ruby. I've been looking around online for answers but most discussions I find on the topic are dated.

Having said that, would it be worthwhile starting to learn one of them on my own or would it be wiser to just focus on mastering Bash and waiting until I actually start out working in the field to learn a scripting language based on what's needed on the job?

Thanks!

Turbocapitalist 08-04-2018 08:23 AM

Quote:

Originally Posted by sabaton (Post 5887627)
Having said that, would it be worthwhile starting to learn one of them on my own or would it be wiser to just focus on mastering Bash and waiting until I actually start out working in the field to learn a scripting language based on what's needed on the job?

Don't worry as much about Bash for scripting as POSIX shell. Whenever possible, stick to clean POSIX and use bashisms sparingly or not at all.

After that learn AWK. If you have some programming background you can pick up AWK in an afternoon of concentrated study. Then a few more and you'll be comfortable.

Ruby is not relevant to system administration, but perl5 is. That will take some time to be comfortable with. It's main strength is text manipulation and pattern matching. It's good for rapid prototyping but also apparently actually fast at run time. There are an increasing number of anecdotes surfacing of perl re-implementations of C applications being faster, at least in the area of text processing. Logs are text.

fatmac 08-04-2018 10:44 AM

Agree - shell/awk/perl

TB0ne 08-04-2018 11:08 AM

Quote:

Originally Posted by sabaton (Post 5887627)
Hi,
This is a question to Linux system administrators from an aspiring sysadmin currently preparing for formal training in the field.

My question pertains to scripting languages. I'm mainly focusing on improving my Bash skills and the training will also involve PowerShell since it doesn't focus exclusively on Linux. They don't teach any of the "Big Three" - Python, Perl, and Ruby - which is why I'm thinking of learning one of them on my own. I've dabbled with all three.

That said, I'm a bit confused as to what scripting language other than Bash would make the best choice. Job vacancies for junior Linux system administrators usually mention the "Big Three" (apart from the ubiquitous Bash, of course) but rarely require knowledge of a specific scripting language. They simply either demand or prefer that you be familiar with at least one of the Big Three.

Which leads me to wonder which of those, in 2018, may be the best choice. I've dabbled with all three. I like Ruby and Perl most, although Python comes up somewhat more often than Perl or Ruby. I've been looking around online for answers but most discussions I find on the topic are dated.

Having said that, would it be worthwhile starting to learn one of them on my own or would it be wiser to just focus on mastering Bash and waiting until I actually start out working in the field to learn a scripting language based on what's needed on the job?

I agree with both Turbocapitalist and fatmac...but I'll just say "use what you are comfortable with". At the end of the day, if YOU are the administrator, then you have to have something you know how to work with, to get the job done quickly. There isn't a programmer/administrator alive who would do the same thing as another programmer, to get a problem solved. Administration tasks aren't any different...scripting solutions that WORK is what's important.

If it takes you 10 minutes in bash, and an hour in python, then python isn't what you should use. Another admin may be reversed...start with what you know, and build on it.

syg00 08-04-2018 06:06 PM

Quote:

Originally Posted by Turbocapitalist (Post 5887628)
If you have some programming background you can pick up AWK in an afternoon of concentrated study.

I must be the dumbest smuck on the planet ...

Turbocapitalist 08-05-2018 12:23 AM

Quote:

Originally Posted by syg00 (Post 5887812)
Quote:

If you have some programming background you can pick up AWK in an afternoon of concentrated study.
I must be the dumbest smuck on the planet ...

I deliberately left out "mastering AWK" from that plan ;) but plead guilty to not clearly refering to the basics. Once can definitely pick up enough AWK in a short time to be really very useful.

scasey 08-05-2018 01:29 AM

Quote:

Originally Posted by syg00 (Post 5887812)
I must be the dumbest smuck on the planet ...

Or one of...I concede that I've not managed to grok awk to date...and that's over many, many years.

Michael Uplawski 08-05-2018 10:55 AM

This type of question in an international Internet-Forum, presented to the mixed audience that we are, does not make much sense, I am afraid.
  • Administration” is not defined, and thus the objectives are not clear.
  • Best” cannot be the attribute of anything which has to respond to a bunch of changing, emerging, disappearing and unperceived claims and requirements.

I feel good, using my languages. So, mine must be the best, which is basically the same as any other kind of response that you can get.

Choose for an audience the guys and gals, that you have to respond to, in your job and whatever kind of clientele might have to take a look at your code, once in a while. They know the BEST of all answers EVER!

chrism01 08-05-2018 08:19 PM

When working in bash, it's definitely good to be able to use one-liner (simple) awk or sed tricks; makes extracting info easier.
See google for many many examples.

For deeper stuff, python or perl is traditional.
I haven't seen it done in ruby but some people may.

As above, use whichever you feel confortable with.
FWIW, the extensive Perl docs/books do include Perl book for SysAdmins http://shop.oreilly.com/product/9781565926097.do
There are many other useful links on google, as Larry Wall (the inventor of Perl) invented it originally for Sysadmin work & it's been around for many years.
Stick to v5.x https://perldoc.perl.org/

sabaton 08-06-2018 03:42 PM

Hi guys,

Thanks a lot for sharing your thoughts and advice! Much appreciated.

I've been reading up on AWK and it sure looks worthwhile learning at least the basics. I did come across AWK in other discussions but never took the time to look into it.

When it comes to the "Big Three", I think I'll go for Perl. It seems to make sense for an absolute beginner as myself and I've dabbled with it more than with the other two. And as someone who appreciates flexibility, I also rather like its motto "There's more than one way to do it" as opposed to that of Python. But that's just my personal preference.

That said, I do agree with Michael that it's all pretty relative and what matters is getting the job done. At least, that's how I interpreted it. I just needed some pointers to help me decide and that's what I got.

Thanks again!

netjess 08-08-2018 11:22 AM

If I suggested one in would be Perl. You can make system scripts or websites with it. See OTRS helpdesk system, written in Perl. As far as job market I think it has the most potential as well. Currently anyway.

sabaton 08-08-2018 05:00 PM

Quote:

Originally Posted by netjess (Post 5889471)
See OTRS helpdesk system, written in Perl.

Didn't know it was written in Perl! Interesting. Thanks.


All times are GMT -5. The time now is 03:02 PM.