Unix / Perl Bods - ...
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

[Closed] Unix / Perl Bods - Best way to learn a few basics

21 Posts
16 Users
0 Reactions
116 Views
Posts: 690
Free Member
Topic starter
 

Afternoon all,

I'm already in the IT game, experienced network bod.

The way my work goes, it's balls to the wall nuts and then backs off for a couple of weeks then goes nuts again.

Anyway, I'm thinking I'd like to learn a few basic things (during the quiet periods) with Unix and scripting. Not for a career change, but rather to help me write some basic scripts and use Unix / Perl as a way to automate some of the more mundane tasks.

Plus I seem to be getting more involved with the net management systems so although I work with the front ends, it would be good to have an idea what's going on behind the scenes.

Can anyone recommend sources on the web or books which would be a good place to start to learn enough of the basics to put a few things into practice. Ideally I prefer to learn by doing small labs and building up my knowledge step by step, I'm very much a person who learns best by doing.

Thanks for any info.
GL.


 
Posted : 19/03/2014 1:24 pm
 DrJ
Posts: 13416
Full Member
 

Not an answer to your question (sorry) but isn't Python the new Perl?


 
Posted : 19/03/2014 1:30 pm
Posts: 1318
Free Member
 

I'd shove a Linux VM on your machine to play with - unless you're normally on a Mac in which case just open Terminal :).

Shell scripting is pretty powerful for a lot of tasks. I learned using the O'Reilly books on Korn Shell, Bash etc. and getting on and doing tasks. I am sure someone will be along with tutorial etc - but the books served me pretty well to learn and then as references once I was up and going.


 
Posted : 19/03/2014 1:33 pm
Posts: 0
Free Member
 

I'm very much a person who learns best by doing.
Then do it. Install Perl, get the Camel book (Programming Perl from O'Reilly) and look at the millions of examples on the web.
But as DrP says, Perl is for bearded sandal wearers, Python is what the kool kids are using.


 
Posted : 19/03/2014 1:35 pm
Posts: 13594
Free Member
 

I'd learn Shell script first, then move on to Pearl / Python.


 
Posted : 19/03/2014 1:38 pm
Posts: 28
Free Member
 

Perl is for bearded sandal wearers

OK, somewhat unshaven and wearing Birkenstocks today ( working from home )...

Programming Perl, Learning Perl and Automating System Administration with Perl would be the 3 main books you would need.


 
Posted : 19/03/2014 1:40 pm
Posts: 13594
Free Member
 

Python is what the kool kids are using.

I thought Ruby was where it's at now?


 
Posted : 19/03/2014 1:41 pm
Posts: 0
Free Member
 

the cool kids my be using python but perl is a lot more forgiving and is used to hold a lot of systems together. plus it's much more likely to be on any *nix systems as default.


 
Posted : 19/03/2014 1:44 pm
Posts: 0
Full Member
 

Then do it. Install Perl, get the Camel book (Programming Perl from O'Reilly) and look at the millions of examples on the web.

Wot he said. The O'Reilly books are almost always worth the cover price (definitely is in this case) and look great lined up in your office on a bookcase 🙂

Not an answer to your question (sorry) but isn't Python the new Perl?

No. As always (in IT) - it depends. No harm in learning both though!

Plus I seem to be getting more involved with the net management systems so although I work with the front ends, it would be good to have an idea what's going on behind the scenes.

For this, PERL is a fine choice on *nix. Have written a lot of backend code for Nagios plugins in Perl in the past. A quick tip, you WILL need to use reg exps a lot so get comfortable with them now. I had a quick peek at some bits I wrote years back and it's barely understandabale to me now (obviously I commented my code thoroughly.. just not how each bit actually worked, I assumed I'd always know :-))

EDIT: No beard or sandals here. Ever.


 
Posted : 19/03/2014 1:45 pm
Posts: 13594
Free Member
 

A quick tip, you WILL need to use reg exps a lot so get comfortable with them now. I had a quick peek at some bits I wrote years back and it's barely understandabale to me now (obviously I commented my code thoroughly.

Powerful though they are, they're a nightmare to read. I tend to split them up one bit at a time just so it's easier to reverse engineer years later. When you get a full line of \/\\.\/[]\/. it's a complete nightmare to work out what is going on. Plus every scripting language seems to have different variants eg Expect and Bash don't follow the same syntax.


 
Posted : 19/03/2014 1:50 pm
Posts: 0
Full Member
 

Agreed, and I was delighted to find Powershell had yet another hand grenade to throw into the mix 🙄


 
Posted : 19/03/2014 2:14 pm
Posts: 8722
Free Member
 

Do you have any Unix skills already?

As people have said, the OReilly books are a good (and well reccommended by the look of it!) start. Perl Programming and The Perl Cookbook are what I got when I was learning Perl and often dip into both to have a recap of stuff.

Someone mentioned shell scripting first. I'd suggest this might be a good idea - its dead easy if you do know Unix stuff. I'm not sure of any good books to read on shell scripting but theres a wealth of info on the internet available for nowt.

Oh, and you'll learn to love vi 😉


 
Posted : 19/03/2014 3:33 pm
Posts: 0
Free Member
 

some of the o'reilly books are good...

best to check the reviews on amazon.

if you create an account on oreilly, or maybe buy an ebook from them, they are constantly having 50% off sales on their ebooks, which makes life easier.

Microsoft press were with Oreilly but are leaving, so the MS books are 60% off at the moment, although obviously these are not unix books.


 
Posted : 19/03/2014 4:17 pm
Posts: 690
Free Member
Topic starter
 

Sorry for delay in getting back to you guys, stuck in meetings yesterday and techi presentations today.

I'll let you into a little secret....when I first started to try and move out from IT operations (batch runs and tape monkey tasks) I thought about going into Unix...tried to read some books, spent a bit of time with the unix team on my days off etc...but the "position" fell through when the head of the team was fired....at the same time I picked up a Network book that made perfect sense to me and the rest was history, as they say.

Anyways, I went searching through my old books and found the following:

Both O'Reilly books.

Unix in a Nutshell, System V and solaris 2.0....I've had a look through that one and I reckon it's just commands for someone that knows about Unix already.

2nd one is sed and awk, had a quick look through it (whilst the kids were trying to look at the nice animals on the front cover)and noticed there is a bit about regular expressions then moves onto sed and awk. Know a few basic things on reg exp from the Cisco World.

Now, before I go delving into the book and bearing in mind that I'm not looking to do anything really fancy, just take text, order it into a uniformed style and create files to boot commands back into cisco boxes, are sed and awk still active....or is it old hat? Just looked, think I bought these books back in 97.

Funnily enough, one of the presentations on this super "controller" which will configure and control "ALL" network devices from a central point (Cisco have been talking about this for the past 4-5 years I think) started mentioning Python....and how us Cisco nerds need to start understanding a bit of programming.....my Geek levels might go through the roof down this slippery slope.


 
Posted : 20/03/2014 7:52 pm
Posts: 8
Free Member
 

Nah, you want the O'Reilly book specifically on regex (Mastering Regular Expressions), which I actually read cover to cover after an op. Fascinating.

Sed/awk are great and while I do recall an installation program for a UNIX application written in 'awk' (basically wrapping stuff with system() calls in a BEGIN { } structure) I would recommend going down the python route. Ruby seems to be going into a niche (though I'm installing Motorola's 'rhoconnect' at work which uses ruby and gems) but python is a great language to start with.

Just remember your formatting as it's an easy way to think your script won't work!

EDIT: Also remember *which* sed/awk you're using. Solaris is different from HP-UX which is different from Linux. Linux is where it's at with gawk/gsed and of course Python is separate (though check version numbers).


 
Posted : 20/03/2014 8:17 pm
Posts: 0
Free Member
 

A Raspberry Pi is a good starting point
There are loads of tutorials available for python and bash


 
Posted : 21/03/2014 8:39 pm
Posts: 959
Full Member
 

If you think awk is the solution, you haven't understood the problem. 🙂

I'd second the RPi suggestion, cheap and cheerful.


 
Posted : 21/03/2014 8:48 pm
Posts: 13916
Free Member
 

I'm no IT guru but I'm having a great time playing with bash and python on Pi.


 
Posted : 21/03/2014 10:38 pm
Posts: 8722
Free Member
 

Put the sed/awk book down and step away! That's really not the sort of thing you want to be reading before learning Unix etc! I know - I've got a dusty copy of it on my desk which I try to avoid ever referencing!!!!!


 
Posted : 22/03/2014 9:42 am
Posts: 0
Free Member
 

A perl interpreter will be installed on pretty much any Linux/Unix server available. As such it's a great scripting skill to have under your belt.


 
Posted : 22/03/2014 9:48 am
 pdw
Posts: 2206
Free Member
 

Personally I wouldn't bother with sed or awk. Modern computers are sufficiently powerful that the cost of loading up a Perl or Python interpreter is negligible, so you may as well use them rather than trying to use shell scripting.

Perl vs Python is an interesting one. Perl is great for gluing stuff together, and for very rapidly doing bits of data munging, but for anything which is non-trivial and which you're going to have to maintain over a long time, I'd use Python. The Perl programming moto of "there's more than one way to do it" is actually an absolutely terrible ideology for any code that has to be maintained by more than one person, as in order to work on the code, you need to understand all the different ways of using it that have been used by different people.

Read the Camel book, and learn the bit on nested data structures off by heart.


 
Posted : 22/03/2014 10:26 am
Posts: 13594
Free Member
 

Does depend on what systems you work on, lots of embedded systems won't have Pearl or Python and you just end up with a cut down bash and vi (e.g. busy box package).


 
Posted : 22/03/2014 10:29 am

6 DAYS LEFT
We are currently at 95% of our target!