Let's talk about Scripting - Learning it

kenrinkenrin Member Posts: 51 ■■□□□□□□□□
I use CentOS and Ubuntu on a daily basis but with the availability of Cpanel and Webmin or other panels most of these things I never need to touch or make a script for. Even with most popular applications the scripts are all included.

I just want to know some good resources or books for learning bash | perl that focus on system administration. I absolutely suck at this kind of stuff because to me it all seems like programming. In order to move up I need to learn this skill.

The resources I have been able to find are either too basic (usually web sites) or books geared to either users learning the command line or programming. Where is the middle ground?

Comments

  • UnixGuyUnixGuy Mod Posts: 4,564 Mod
    Bash and perl and different things so pick one and focus on it (for now). I'd pick Bash any day.

    Pick O'Reilly bash books, read it and workout all the examples. Then pick O'Reilly cookbook and do the same.

    Use it actively at work, and Google things when you get stuck (Stack exchange will be your best friend).

    Enjoy.
    Certs: GSTRT, GPEN, GCFA, CISM, CRISC, RHCE

    Check out my YouTube channel: https://youtu.be/DRJic8vCodE 


  • DoubleNNsDoubleNNs Member Posts: 2,015 ■■■■■□□□□□
    Get a bash or perl programming book. Honestly, you might think it's "programming" but both of those are languages heavily used for scripting so the books tailer to that, not software engineering and algorithms.
    For general administration, bash would be easier to apply.
    Goals for 2018:
    Certs: RHCSA, LFCS: Ubuntu, CNCF CKA, CNCF CKAD | AWS Certified DevOps Engineer, AWS Solutions Architect Pro, AWS Certified Security Specialist, GCP Professional Cloud Architect
    Learn: Terraform, Kubernetes, Prometheus & Golang | Improve: Docker, Python Programming
    To-do | In Progress | Completed
  • ExpectExpect Member Posts: 252 ■■■■□□□□□□
    Bash all the way.

    use "Pro Bash Programming" by OReilly, it's a pretty good book for shell scripting.
  • DoubleNNsDoubleNNs Member Posts: 2,015 ■■■■■□□□□□
    Personally, I went from "the Linux Command Line" to "Unix Shell Programming"
    Unix Shell Programming (3rd Edition): Stephen G. Kochan, Patrick Wood: 9780672324901: Amazon.com: Books
    Goals for 2018:
    Certs: RHCSA, LFCS: Ubuntu, CNCF CKA, CNCF CKAD | AWS Certified DevOps Engineer, AWS Solutions Architect Pro, AWS Certified Security Specialist, GCP Professional Cloud Architect
    Learn: Terraform, Kubernetes, Prometheus & Golang | Improve: Docker, Python Programming
    To-do | In Progress | Completed
  • VeritiesVerities Member Posts: 1,162
    I've been reading Linux Command Line and Shell Scripting Bible, 3rd Edition and have found it to be overall an easy read. Even though I think there's too many of these damn BASH scripting books, I'm adding all the ones listed in this thread to my reading list.
  • kenrinkenrin Member Posts: 51 ■■□□□□□□□□
    I think i'm going to pick up the Unix Shell Programming and Linux Command Line and Shell Scripting Bible after reading the reviews on a lot of books. There was another one that I liked the reviews on but it was expensive compared to others. It has a very long title "Mastering Unix Shell Scripting: Bash, Bourne, and Korn Shell Scripting for Programmers, System Administrators, and UNIX Gurus"

    My shelf is getting massive here at work. >.<
  • XavorXavor Member Posts: 161
    The Bash scripting guide (free online):
    Advanced Bash-Scripting Guide

    Python course at Codeacademy (free online)

    Understanding how to:
    for x in `sed | awk | sort `; do something $x; done
    is the basics for bash

    There is expect scripting if you need to login to servers to do commands (think no root logins)

    Python for more advanced scripting and/or reading comprehension for linux errors because many linux programs are python.

    Since you're doing web admin apparently, learning to use scripting to parse your logs is a good real world scenario.
  • lsud00dlsud00d Member Posts: 1,571
    There are so many good articles on this site--

    nixCraft — Linux Tips, Hacks, Tutorials, And Ideas In Blog

    As others have hinted at, bash/linux shell scripting is focused on text manipulation to do things. Grep, sed, awk, cut, sort, etc will take you far.
  • Joe_WulfJoe_Wulf Registered Users Posts: 2 ■□□□□□□□□□
    +1 for Xavor on promoting the Bash Scripting Guide; I was going to mention it, but glad to see someone already did!
    +1 for lsud00d on promoting the nixCraft web site.

    Both are excellent resources.
  • ally_ukally_uk Member Posts: 1,145 ■■■■□□□□□□
    Does anybody have any good examples of menu driven system administration scripts? or know any good books that teach you how to build one?
    Microsoft's strategy to conquer the I.T industry

    " Embrace, evolve, extinguish "
  • DoubleNNsDoubleNNs Member Posts: 2,015 ■■■■■□□□□□
    Almost all scripting books will touch on that.
    ally_uk, I've seen you post a lot about scripting for months and asking for resources. Have you gone thru any of the suggestions we've provided yet?
    Goals for 2018:
    Certs: RHCSA, LFCS: Ubuntu, CNCF CKA, CNCF CKAD | AWS Certified DevOps Engineer, AWS Solutions Architect Pro, AWS Certified Security Specialist, GCP Professional Cloud Architect
    Learn: Terraform, Kubernetes, Prometheus & Golang | Improve: Docker, Python Programming
    To-do | In Progress | Completed
  • ally_ukally_uk Member Posts: 1,145 ■■■■□□□□□□
    I can't decide whether to learn bash scripting or python my mind is torn between the two :)

    I have been watching some Python 3 videos recently am currently making my way through the CBT videos, and other videos I am just having trouble getting
    focused though and knuckling down.
    Microsoft's strategy to conquer the I.T industry

    " Embrace, evolve, extinguish "
  • brombulecbrombulec Member Posts: 186 ■■■□□□□□□□
    Learn both - you'll have bash/csh/sh on each and every server but I'm 100% sure that you'll find a server without installed python (for security reasons). So knowing both is IMHO the best option.

    --
    Regards
  • UnixGuyUnixGuy Mod Posts: 4,564 Mod
    agree, start with Bash, it will only take a month trust me! It's really easy. Get started and it'll all flow.
    Certs: GSTRT, GPEN, GCFA, CISM, CRISC, RHCE

    Check out my YouTube channel: https://youtu.be/DRJic8vCodE 


  • JockVSJockJockVSJock Member Posts: 1,118
    Alot of good tips here on this thread. I wanted to add my own as well.

    The Geek Stuff - Great Source of Linux and Oracle knowledge
    The Geek Stuff

    Commandlinefu.com - All CLI stuff from Linux to Mac OS X to HP Linux
    All commands | commandlinefu.com
    ***Freedom of Speech, Just Watch What You Say*** Example, Beware of CompTIA Certs (Deleted From Google Cached)

    "Its easier to deceive the masses then to convince the masses that they have been deceived."
    -unknown
  • lsud00dlsud00d Member Posts: 1,571
    ally_uk wrote: »
    Does anybody have any good examples of menu driven system administration scripts? or know any good books that teach you how to build one?

    The linux command dialog is perfect for this--I made a "GUI"-driven shellscript for admin'ing Squid proxy that centered around either one or multiple one-liners as functions that did common tasks like emptying cache, rotating log files, re-read config (after config is updated), etc.

    UNIX Command Line: Linux dialog utility short tutorial

    Bash display dialog boxes - Linux Shell Scripting Tutorial - A Beginner's handbook
  • ally_ukally_uk Member Posts: 1,145 ■■■■□□□□□□
    https://www.youtube.com/watch?v=btmV1B8M4F4

    found the above resource on Bash Scripting, Also more videos on different Linux subjects could be useful for some people
    Microsoft's strategy to conquer the I.T industry

    " Embrace, evolve, extinguish "
  • UnixGuyUnixGuy Mod Posts: 4,564 Mod
    @ally_uk: Paralysis by analysis. You're thinking too much about resources. Grab a bash book - any book - and start. It's not as hard as you think it is. There is no perfect resource. There's no perfect language. There is no perfect way to start. All you need to do is actually start somewhere - with anything. It's an on going process, scritping is a skill that you have to use a lot. and when you stop using it you will forget things - it's normal. Just start mate :)
    Certs: GSTRT, GPEN, GCFA, CISM, CRISC, RHCE

    Check out my YouTube channel: https://youtu.be/DRJic8vCodE 


  • ally_ukally_uk Member Posts: 1,145 ■■■■□□□□□□
    Yeah you are right, I am getting ahead of myself it always seems to be a case of initially I sit down start reading a book or watch videos and then I jump ahead and become fixated on how to do one specific task. I then jump around resources and get ahead of myself and end up with headaches.

    I need to take things down a level and start with the basics and gradually inc operate concepts.
    Microsoft's strategy to conquer the I.T industry

    " Embrace, evolve, extinguish "
Sign In or Register to comment.