% Why Learn the Unix/Linux Command Line and Shells? % Ian! D. Allen - idallen@idallen.ca - www.idallen.com % Winter 2013 - January to April 2013 - Updated Sat Aug 31 11:50:22 EDT 2013 What is Linux and why do I care? ================================ - How Linux is Built: - Log in to [lynda.com] and see “Chapter 1. Getting Started” in “Up and Running with Linux for PHP Developers”. Go under the “preferences” tab and turn on “Closed captioning” to see the words as well as hear them. You should be able to answer: - what is Free (as in “free speech”) Software - what is Linux - what is Virtualization - Log in to [lynda.com] and see “Chapter 1. Introduction to Unix - What is Unix” in “Unix for Mac OS X Users”. Go under the “preferences” tab and turn on “Closed captioning” to see the words as well as hear them. You should be able to answer: - where did Unix (from which Linux came) originate? - what do Unix systems have in common? Can’t I just learn Unix online? =============================== Sure! You will find a video course by first logging in to [lynda.com], then see [Unix for Mac OS X Users] - This is an entire online Unix course, usable from school or from home (with your Algonquin student library card information)! - Doesn’t cover Linux installation or booting - Also covers Macintosh-only Unix tools (last chapter) More online courses (no video, though) ====================================== - - - - (Includes a 522-page free book!) - - Command Line vs. GUI: Power Users need more than GUI ==================================================== > Sysadmin motto: “Anything worth doing will be done more than once.” - A short note on why even modern GUIs just don’t have the power needed to handle repeated tasks. - Original: - Mailing List: A GUI user wrote: > There are plenty of examples. Take sending a message by e-mail for example. > No complex menu navigaion is required for that in a GUI, such as Evolution, > for example. You simply click on “New” fill in the form with appropriate > data, and click send. Okay, I just sent a file to one user. Now how do I repeat that and only have to change the userid, or only the file name, without having to “fill in the form” again (possibly making mistakes or forgetting exactly what I filled out in the previous form)? In a command line, I back up one line (one keystroke) and change “user1” to “user2” or “file1” to “file2” and push return. If I realize I want to do this a lot, I save that line in a script file and pass the userid or file name in as a parameter, so I only need type “./mailusers user3” or “./mailfiles file3”. Say it’s tomorrow and I can’t remember exactly which files I sent to whom. My command line history tells me exactly what I sent and to whom and allows me to repeat what I did exactly, only changing the little bits I want changed. Say it’s next month and I realize I’m always sending these emails to the same people, so I collect the command lines that do that and put them all into one script file that makes it all happen: “./doall” Say it’s next year and I realize I’m always doing these things at the same time every month, so I put an entry in my crontab that will automatically run my “doall” script on the 15th of every month. Say I want my friend in Slovenia to be able to do exactly what I do. I send him my script file. What existing GUI lets me do that sort of thing? To summarize: - automatically saves the last thing I did - gives me keyword-searchable history of what I did - lets me edit any little piece of what I did and repeat it - allows me to save and parametrize what I did so that in future I only have to specify the little bits that change - lets me group a common series of things I do into a repeatable script so that it’s easy to do all those things in that order - lets me run anything unattended (via crontab or other background scheduling system) - lets me pass my saved and customized actions to another user, who can also customize and modify them further > You’re talking about taking an action that you can repeat later with the > same parameters, or parameters you can easily change. So, write the > software so that it can save and retrieve parameters for a future session > without using a complex menu. My command line doesn’t require me to rewrite any applications. I can parametrize and run all the applications unchanged. What existing GUI lets me do these things, all of which I do *a lot*? “Anything worth doing will be done more than once.” References: Getting Useful Work Done ======================== > The designer of a program that provides a graphical user interface must > anticipate all the possible ways in which the user will interact with the > program and provide ways to trigger the appropriate program responses by > means of pointing and clicking. Consequently, the user is constrained to > working only in predicted ways. The user is therefore unable to adapt the > graphical user interface program to accommodate unforeseen tasks and > circumstances. In a nutshell, that’s why many system administration tasks > are performed using the shell: system administrators, in fulfilling their > responsibility to keep a system up and running, must continually deal with > and overcome the unforeseen. - Bill McCarty, “Learning Debian GNU/Linux”, Chapter 13 Mastery of Unix =============== > Mastery of UNIX, like mastery of language, offers real freedom. The price > of freedom is always dear, but there’s no substitute. Personally, I’d > rather pay for my freedom than live in a bitmapped, pop-up-happy dungeon > like NT. I’m hoping that as IT folks become more seasoned and less > impressed by superficial convenience at the expense of real freedom, they > will yearn for the kind of freedom and responsibility UNIX allows. When > they do, UNIX will be there to fill the need. - Thomas Scoville, “The Elements of Unix Style: Unix as Literature” BROKEN LINK: http://www.thomasscoville.com/PCarticle.html You Gotta Think First ===================== > Back in the days of the command-line interface, users were all Morlocks who > had to convert their thoughts into alphanumeric symbols and type them in, a > grindingly tedious process that stripped away all ambiguity, laid bare all > hidden assumptions, and cruelly punished laziness and imprecision. Then the > interface-makers went to work on their GUIs, and introduced a new semiotic > layer between people and machines. People who use such systems have > abdicated the responsibility, and surrendered the power, of sending bits > directly to the chip that’s doing the arithmetic, and handed that > responsibility and power over to the OS. This is tempting because giving > clear instructions, to anyone or anything, is difficult. We cannot do it > without thinking, and depending on the complexity of the situation, we may > have to think hard about abstract things, and consider any number of > ramifications, in order to do a good job of it. For most of us, this is > hard work. We want things to be easier. How badly we want it can be > measured by the size of Bill Gates’s fortune. […] > > In other words, the first thing that Apple’s hackers had done when they’d > got the MacOS up and running–probably even before they’d gotten it up and > running–was to re-create the Unix interface, so that they would be able to > get some useful work done. At the time, I simply couldn’t get my mind > around this, but: as far as Apple’s hackers were concerned, the Mac’s > vaunted Graphical User Interface was an impediment, something to be > circumvented before the little toaster even came out onto the market. - Neal Stephenson, “Cryptonomicon”, “In the beginning was the Command Line” http://www.csn.ul.ie/\~caolan/publink/etexts/stephenson.txt -- | Ian! D. Allen - idallen@idallen.ca - Ottawa, Ontario, Canada | Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/ | College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/ | Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/ [Plain Text] - plain text version of this page in [Pandoc Markdown] format [lynda.com]: https://lyceum.algonquincollege.com/Lynda [Unix for Mac OS X Users]: http://wwwlyndacom.rap.ocls.ca/Mac-OS-X-10-6-tutorials/Unix-for-Mac-OS-X-Users/78546-2.html [Plain Text]: 100_why_shell.txt [Pandoc Markdown]: http://johnmacfarlane.net/pandoc/