bubblegumpi
Posts: 39
Joined: Tue Sep 06, 2016 3:22 am

Whats a good bash/terminal tutorial?

Wed Jan 04, 2017 11:38 pm

For starting from the beginning? I actually found the best LInux book by Mark Sobel but currently I'm having it reprinted into a large format and won't see it for about a month.

Also does this website have tutorials that are not geared towards children? You would think that would be easier to learn but its painfully slow and seems like technical info is omitted since it has to be understandable to children.
New to Linux, Keep in mind I'm legally blind, so my questions may seem dumb. Yes, I did a search, that's why I'm here. Links to FAQ'a and youtube are a HUGE help.| MY OS: Pi 3B with Oct'16 Noobs Raspberrian, 16Gb SD drive, HDMI video, no extras

User avatar
topguy
Posts: 6466
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Whats a good bash/terminal tutorial?

Wed Jan 04, 2017 11:50 pm

Googling "introduction to linux commandline" should give you plenty of sources to pick from.

Also looking through the issues of MagPi should also have lots of guides, they also have a special issue about the command line. https://www.raspberrypi.org/magpi/issue ... bash-vol1/

Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: Whats a good bash/terminal tutorial?

Wed Jan 04, 2017 11:54 pm

How about:

http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/

Personally, after twenty years of using Linux I still find BASH unfathomable. A Syntactic nightmare. I use it for redirection and piping on the command line of course. I use it for simple scripts sometimes. If anything gets complicated I'd rather use something else. (Or get somebody else to do it :) )
Memory in C++ is a leaky abstraction .

Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: Whats a good bash/terminal tutorial?

Thu Jan 05, 2017 12:02 am

bubblegumpi,
...does this website have tutorials that are not geared towards children?
That is a good question.

Thing is The Pi uses Raspbian. Raspbian is basically Debian Linux. Debian Linux is based on Unix, including tools like BASH.

As such there are millions of tutorials and tons of documentation out on the net about Unix/Linux tools. A lot of which is applicable to the Pi.

So it makes sense that the Pi Foundation does not reproduce all of that "material for adults".

That just leaves the problem of connecting people from the "children's" Pi world to the "adult's" Unix world.

As your question about BASH demonstrates.
Memory in C++ is a leaky abstraction .

bubblegumpi
Posts: 39
Joined: Tue Sep 06, 2016 3:22 am

Re: Whats a good bash/terminal tutorial?

Sat Jan 21, 2017 11:50 am

Heater wrote:How about:

http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/

Personally, after twenty years of using Linux I still find BASH unfathomable. A Syntactic nightmare. I use it for redirection and piping on the command line of course. I use it for simple scripts sometimes. If anything gets complicated I'd rather use something else. (Or get somebody else to do it :) )
OK so I started this one but it still seems like its missing what some of the things do. Like it just jumps into the commands.

How did you guys learn? Thing is I'm legally blind so please don't just tell me to "google it". That doesn't help. MY unix book is still not back.
New to Linux, Keep in mind I'm legally blind, so my questions may seem dumb. Yes, I did a search, that's why I'm here. Links to FAQ'a and youtube are a HUGE help.| MY OS: Pi 3B with Oct'16 Noobs Raspberrian, 16Gb SD drive, HDMI video, no extras

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Whats a good bash/terminal tutorial?

Sat Jan 21, 2017 12:25 pm

http://www.tldp.org/LDP/Bash-Beginners- ... Guide.html
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://www.gnu.org/software/bash/manual ... ltins.html

A lot of the stuff is much like a Windows cmd.exe shell.

Basics are
  • ls
  • mv
  • cp
  • cat
  • less
More advanced are
  • grep
  • awk
  • sed
which, of course, are running programs rather than built-in commands.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

KMyers
Posts: 35
Joined: Fri Nov 09, 2012 9:46 pm

Re: Whats a good bash/terminal tutorial?

Sat Jan 21, 2017 6:41 pm

Hi, there are also some decent tutorials at www.adafruit.com

They are listed in the Learn section then Raspberrypi. Different ones to command line and some simple automation of daily tasks, I highly recommend them.

Ken

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Whats a good bash/terminal tutorial?

Sun Jan 22, 2017 12:32 am

bubblegumpi wrote:OK so I started this one but it still seems like its missing what some of the things do. Like it just jumps into the commands.
How did you guys learn? Thing is I'm legally blind so please don't just tell me to "google it". That doesn't help. .
One of the problems with googling it is that you'll often ask for how to do something in bash and get back how to do it in awk or grep or sed. If I wanted to know how to do it in awk or grep or sed, I'd have googled that. This is just something you have to put up with, like how you have to put up with asking for how to do something in python 3 and getting back how to do it in python 2.7. Grrrr.

A skeleton of a bash program, which could be done in a lot of different ways, is a good idea to start: For example:

Code: Select all

#!/bin/bash            <-- this tells the system what program to run your script with

# these are comments
STRING="Hello World"
echo "First string: $STRING"
sleep 3s
echo "Delayed string $STRING"
But if your program is at all getting large or even just a bit unwieldy, you should look into using functions. Of course bash has them but its very weird:

Code: Select all

#!/bin/bash

echo_function(){
  STRING="Hello World"
  echo "First string: $STRING"
  sleep 3s
  echo "Delayed string $STRING"
}

echo_function  # this should print one line and wait and print the second
echo "Next call:"
RETURN_STRING=$( echo_function )
printf "All of the lines are printed at once,\nthe pause is inside"
printf " the function: \n${RETURN_STRING}\n"
Mostly try to use echo for your debugging, so you can grep and make sure you've found them all. Use printf for real screen prints that you are going to leave in your program, it is a more standardised way to output text. You'll find echo used everywhere though, it just can cause problems since different versions of bash and shells operate with it in slightly different ways.

You'll also want to keep a cheat sheet with the exact crazy form of various things in bash, if it needs or doesn't need quotes on variables, if it needs or doesn't need spaces after itself, like the [ ] and [[ ]] commands, the if statement, etc. Numbers are also bizarre in bash, I think there's about six different ways to add one to a variable. Bash is very powerful, so no matter how mad you get at the craziness, it's worth taking a break and coming back to. Good luck, I'm sure people around here will help as needed.

User avatar
scruss
Posts: 3155
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Whats a good bash/terminal tutorial?

Sun Jan 22, 2017 1:46 am

bubblegumpi wrote:How did you guys learn?
Through years of trying things and making small mistakes. Having little projects to (supposedly) make my life easier (but frequently take longer to set up). The one that taught me the most was teaching a bunch of really motivated people — I had to know my stuff, 'cos they went' from "What does ls do?" to "I'm not sure that this regex is capturing what I need all the time" in about a week.
Thing is I'm legally blind so please don't just tell me to "google it". That doesn't help. MY unix book is still not back.
Sorry to hear that your book hasn't arrived. Print-on-demand was supposed to solve the large-print problem, but all the machines I've seen are limited to Letter or A4 paper.

This is a good book, and is available as a PDF for free: “The Linux Command Line by William E. Shotts, Jr.”, http://linuxcommand.org/tlcl.php
While it's an unprotected PDF so has no limit on zoom size, it doesn't have the most useful table of contents or index. PDF viewing under Raspbian is a bit weak; hope it's good enough for you. If not, I'm happy to dig out other options.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

ejolson
Posts: 5200
Joined: Tue Mar 18, 2014 11:47 am

Re: Whats a good bash/terminal tutorial?

Sun Jan 22, 2017 7:11 pm

scruss wrote:PDF viewing under Raspbian is a bit weak; hope it's good enough for you.
This seems like a very nice and comprehensive introduction. What PDF viewer do you recommend? What do you think of evince?

User avatar
scruss
Posts: 3155
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Whats a good bash/terminal tutorial?

Mon Jan 23, 2017 4:06 am

evince is not bad. It's the one I use most, and has almost all of the features I need.

mupdf is really fast but has almost no features. Artifex (the Ghostscript folks) have another called GSView that's pretty neat but you'd have to build from source, which might take a while.

Whatever comes with Raspbian/Pixel - xpdf? gv? - is terrible.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

W. H. Heydt
Posts: 12431
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Whats a good bash/terminal tutorial?

Mon Jan 23, 2017 6:17 am

While they may or may not be the *best* book on any given subject, the O'Reilly books are almost always on my top three list. I do kind of miss their early efforts with the "nutshell handbooks" though. One of those was the only work I could find at the time that actually showed you how to use the "curses" terminal windowing package.

User avatar
CarlRJ
Posts: 598
Joined: Thu Feb 20, 2014 4:00 am
Location: San Diego, California

Re: Whats a good bash/terminal tutorial?

Mon Jan 23, 2017 10:42 pm

W. H. Heydt wrote:I do kind of miss their early efforts with the "nutshell handbooks" though. One of those was the only work I could find at the time that actually showed you how to use the "curses" terminal windowing package.
Our first two were on using/managing UUCP and Usenet, with plain tan paper covers (long before the animal woodcuts), ordered from a tiny ad in the back of one of the computer magazines of the day. Fun times. I was always amused that they had the book titled, "Programming with Curses" - always made me think "what programmer worth their salt needs to be taught how to swear?"

User avatar
solar3000
Posts: 1051
Joined: Sat May 18, 2013 12:14 am

Re: Whats a good bash/terminal tutorial?

Tue Jan 24, 2017 3:05 pm

buy it
http://shop.oreilly.com/product/9780596 ... cationDate

read the whole book:
https://doc.lagout.org/operating%20syst ... amming.pdf

I don't know why o'reilly books are free to read and you can buy it. How do they make any money?
Antikythera

User avatar
scruss
Posts: 3155
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Whats a good bash/terminal tutorial?

Tue Jan 24, 2017 9:54 pm

They're not free to read - just that they also sell un-encrypted e-book versions, and lots of people harvest them for personal libraries.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

User avatar
CarlRJ
Posts: 598
Joined: Thu Feb 20, 2014 4:00 am
Location: San Diego, California

Re: Whats a good bash/terminal tutorial?

Wed Jan 25, 2017 3:46 am

scruss wrote:They're not free to read - just that they also sell un-encrypted e-book versions, and lots of people harvest them for personal libraries.
Actually, there are a number of them that are, in fact, free to read, download, etc., by way of permissions negotiated between the author and O'Reilly. They figure many folks will buy the paper version even though the PDF is available (or intentionally to support the authors). (No, I can't recall which ones, off the top of my head.)

Return to “General discussion”