PDA

View Full Version : Learning Bash is Hard !!!



mikodo
April 22nd, 2011, 06:55 AM
Hi everyone,

I am new to computers and Linux. I am 58 and work in a field that demands a knowledge of the fundamentals before mastering specialties. I actually believe to learn any subject proficiently, learning the fundamentals is a requirement.

So, in my attempt to become proficient with linux, I am studing bash commands and their arguments etc. It is not hard; but damn it is a lot of learning ....

Does any other newbies find learning the fundamentals daunting?

I guess I am just venting....

:)

Metallion
April 22nd, 2011, 07:06 AM
It was kind of hard in the beginning but I forced myself to use the command line as much as possible. Now I miss it whenever I'm in a windows environment.

Try to start with just file management in the beginning. Use tab completion as much as possible and just create/move/copy/delete files through the cli. You'll be up to speed in no time.

mikodo
April 22nd, 2011, 07:15 AM
It was kind of hard in the beginning but I forced myself to use the command line as much as possible. Now I miss it whenever I'm in a windows environment.

Try to start with just file management in the beginning. Use tab completion as much as possible and just create/move/copy/delete files through the cli. You'll be up to speed in no time.
Thanks for the advice and vote of confidence in my getting up to speed in no time. :)

Say, how are things in Japan, since the earthquake? Are things becoming OK again? Sorry, I pay little attention to the news. I of course, have heard of your country's trials though!

Mike

deconstrained
April 22nd, 2011, 07:24 AM
That's somewhat understandable. While command-line bash is easy (as long as you have completion turned on and know what you need), scripting in bash is a friggin nightmare, because bash is a very peculiar and temperamental language (especially with regard to the construction of logical statements), and excepting use of it for the very simplest of tasks, bash isn't practical.

As for Unix/GNU commands: check out the command for viewing their documentation, known as "man" (short for manual)

man man (yes, the manual page viewer has a manual page)

Thewhistlingwind
April 22nd, 2011, 07:30 AM
[snip]
As for Unix/GNU commands: check out the command for viewing their documentation, known as "man" (short for manual)

man man (yes, the manual page viewer has a manual page)

As for that, don't forget info, help and man -k. (If theres any must-know option for man, -k is it.)

Also, trust me, it gets easier as you go along.

mikodo
April 22nd, 2011, 07:32 AM
That's somewhat understandable. While command-line bash is easy (as long as you have completion turned on and know what you need), scripting in bash is a friggin nightmare, because bash is a very peculiar and temperamental language (especially with regard to the construction of logical statements), and excepting use of it for the very simplest of tasks, bash isn't practical.

As for Unix/GNU commands: check out the command for viewing their documentation, known as "man" (short for manual)

man man (yes, the manual page viewer has a manual page)

Thanks for the advice!

I have seen:


man man

It is figgin' huge! LOL!

mikodo
April 22nd, 2011, 07:38 AM
As for that, don't forget info, help and man -k. (If theres any must-know option for man, -k is it.)

Also, trust me, it gets easier as you go along.

Again thanks for the encouragement, and the above quoted advice. I'll check it all out.

:)

weasel fierce
April 22nd, 2011, 07:50 AM
What I found was that there's stuff you'll want to know, because its handy or comes up frequently, and there's a looooot that you'll need so rarely you can look it up :)

mikodo
April 22nd, 2011, 07:59 AM
What I found was that there's stuff you'll want to know, because its handy or comes up frequently, and there's a looooot that you'll need so rarely you can look it up :)

Thanks for sharing your experience!

I am following this well known book by William Shotts:

http://linuxcommand.org/tlcl.php

I'll get back to it; I feel energized by all your responses!

Thanks everyone! :)

Mike

Metallion
April 22nd, 2011, 08:02 AM
Say, how are things in Japan, since the earthquake? Are things becoming OK again? Sorry, I pay little attention to the news. I of course, have heard of your country's trials though!

As far as Tokyo's concerned, everything is fine. Everyone's just going to work as usual. Just that everybody's saving power. Train stations turning off their escalators and such. We still have lots of aftershocks but nothing major. Just had one a few minutes ago in fact.

It's much worse up north though. Huge death tolls and entire villages wiped off the map. :( I'm worried about all the highly radioactive water that got dumped in the sea too. Especially concerning how much sea food we eat here.

mikodo
April 22nd, 2011, 08:13 AM
@ Metallion:

It is so sad to hear of the tragic deaths of your fellow countrymen. I hope you and your family can continue to remain safe and healthy!

Mike

K_45
April 22nd, 2011, 08:16 AM
You'll want to take a look at Ubuntu Toolbox which has 1000 commands that you should be familiar with (and no, you don't need to memorize all of them) and Practical Guide to Linux 2nd edition. Once you've used Linux for a few months, it will all sink in.

Metallion
April 22nd, 2011, 08:22 AM
@ Metallion:

It is so sad to hear of the tragic deaths of your fellow countrymen. I hope you and your family can continue to remain safe and healthy!

Mike

Just for the record, I do live in Tokyo but I'm actually not Japanese myself. My girlfriend is though. Fortunately her family is mostly from Nagasaki. They didn't even feel the quake there. Thanks for the kind words. :)

HermanAB
April 22nd, 2011, 08:50 AM
Howdy,

Actally the most important Linux skill is knowing that there is a special Google version for searching Linux topics!

http://google.com/linux

mikodo
April 22nd, 2011, 08:50 AM
You'll want to take a look at Ubuntu Toolbox which has 1000 commands that you should be familiar with (and no, you don't need to memorize all of them) and Practical Guide to Linux 2nd edition. Once you've used Linux for a few months, it will all sink in.

I'll be checking these books out!

I have been wanting a good command reference book. I prefer unsolicited recommended material like the above, over advertised salesmanship!

Thanks!

mikodo
April 22nd, 2011, 09:01 AM
Howdy,

Actally the most important Linux skill is knowing that there is a special Google version for searching Linux topics!

http://google.com/linux

HermanAB,

I never saw this search engine before. I typed Fstab in it for fun and it threw all sorts of reference links back at me!

Thanks so much!

Mike

EDIT:

I'll be placing another Link for this in my panel for more quick searches, along with this from Crunchbang:

http://crunchbang.org/ubuntu-search-engine/

GabrielYYZ
April 22nd, 2011, 10:37 AM
one thing you can do is download a few scripts, check the syntax and the commands used and, when something gets confusing, man up (:P) that command and learn away.

the man command is one of the things i really, really, REALLY like about linux in general. whenever i forget or don't know an specific argument or the arguments of a command, i man up (:P that was the last one, promise)

Irihapeti
April 22nd, 2011, 10:42 AM
My favourite Bash reference is the ABS (advanced Bash scripting) guide available from http://tldp.org/LDP/abs/

There is also a version in the repositories, which may be older depending on what version of Ubuntu you are running.

Don't let the "advanced" in the title put you off. It starts pretty much with the basics.

nothingspecial
April 22nd, 2011, 12:29 PM
This is the best bash guide I have ever read

http://mywiki.wooledge.org/BashGuide

check the pitfalls and faq sections aswell

danbuter
April 22nd, 2011, 12:45 PM
I'd recommend the wiki over the ABS.

deconstrained
April 24th, 2011, 02:55 AM
One more thing mikodo: hit "/" while using man (or most any page viewer in a Unix-like environment) and then type in a pattern to do a search through the document. That has saved me LOTS of time reading man pages; if you know what you want you can search for it really quickly by just doing that.

kevCast
April 24th, 2011, 06:56 AM
http://bash-fu.com/

mikodo
April 24th, 2011, 07:16 AM
One more thing mikodo: hit "/" while using man (or most any page viewer in a Unix-like environment) and then type in a pattern to do a search through the document. That has saved me LOTS of time reading man pages; if you know what you want you can search for it really quickly by just doing that.

Wow; Thanks for that deconstrained.

I tried:


man rsyncthen:


/compressand there was the option (-Z )

I see this will be very helpful.

:)

mikodo
April 24th, 2011, 07:57 AM
http://bash-fu.com/

More really useful links!

I'm going to be zippin' all over the place!

Thank goodness for multiple workspaces and tabbed browsing! :D

Really though, thanks for the great links.

Mike

mikodo
April 24th, 2011, 08:11 AM
one thing you can do is download a few scripts, check the syntax and the commands used and, when something gets confusing, man up (:P) that command and learn away.

I wouldn't have thought of studying how to write scripts this way!

Thanks.

mikodo
April 24th, 2011, 08:19 AM
@Irihapeti: I will use ABS more and more as my skills progress. Thanks for the link.

@nothingspecial (Like your avatar and name), I can go hard with Greg's Wiki immediately ...
Thanks.

@danbuter ... Thanks for the input.

@K_45 ... I got Ubuntu Linux Toolbox 1000+ Commands PDF ... Thanks!

Mike

Artemis3
April 24th, 2011, 09:33 AM
Option -z is very nice, i love doing rsync transfers for backup.

Did you not play with computers in the 80ies? If you did, this is nothing (unless you spoiled yourself with macs >_<).

For the record, we actually use dash. It is almost identical, but faster.

mikodo
April 24th, 2011, 09:51 AM
Option -z is very nice, i love doing rsync transfers for backup.

Did you not play with computers in the 80ies? If you did, this is nothing (unless you spoiled yourself with macs >_<).

For the record, we actually use dash. It is almost identical, but faster.

Hi Artemis3,

I started with computers 3-4 years ago, so I am still a noob! Just old that's all. LOL.

What is dash? I'll have to read about that.

Here is Wikipedia's description:

https://secure.wikimedia.org/wikipedia/en/wiki/Debian_Almquist_shell

I read about it later; I have to go to bed ...

Thanks for the direction.

Mike

nothingspecial
April 24th, 2011, 10:29 AM
One more thing mikodo: hit "/" while using man (or most any page viewer in a Unix-like environment) and then type in a pattern to do a search through the document. That has saved me LOTS of time reading man pages; if you know what you want you can search for it really quickly by just doing that.

This is actually a feature of less.

You can search any text file with less in this way (press n to go to the next result or N to go to the previous one)

see man less for tons more options.

(The man pages are opened with less ;))

deconstrained
April 26th, 2011, 03:33 AM
(The man pages are opened with less ;))
My mind. It has been blown.

Thewhistlingwind
April 26th, 2011, 03:50 AM
This is actually a feature of less.

You can search any text file with less in this way (press n to go to the next result or N to go to the previous one)

see man less for tons more options.

(The man pages are opened with less ;))

Can I second the "Mind blown" comment?

samalex
April 26th, 2011, 03:06 PM
My suggestion is to submerge yourself in CLI to learn Bash, in other words don't use GUI! When me and I'm betting most others in here learned Bash or any type of Linux/Unix shell it was back when command line was pretty much the preferred way of interacting with the computer so it was the only option. Not unlike MS-DOS systems back in the day when all you had was a book on MS-DOS and a blinking C> (or A>) cursor when the system was powered on.

So setup a system with no Windows Manager or at least disable it, fire up the system, and have fun. Other than fancy websites there's not much you can't do in shell that you can in the GUI. Grab Alpine for email and NNTP (wish UF supported this!), grab GNUEmacs and learn it or Vi, Midnight Commander is an excellent file manager, heck you can even do instant messaging and listen to you MP3's and other media via shell.

Then once you really get a grasp of it you can start hacking together shell scripts. You can script in any number of languages, like PHP, Python, Perl, etc, and these work great in the command line.

So submersion is what I suggest to force yourself to learn it.

Sam

spibou
April 26th, 2011, 04:19 PM
This is actually a feature of less.

You can search any text file with less in this way (press n to go to the next result or N to go to the previous one)

see man less for tons more options.
Or press h from within less to see the online help. Pressing q will take you back to the file you were viewing.


(The man pages are opened with less ;))
And this is customisable by using the MANPAGER environmental variable. Do man man for specifics.

spibou
April 26th, 2011, 04:34 PM
one thing you can do is download a few scripts, check the syntax and the commands used and, when something gets confusing, man up (:P) that command and learn away.
I wouldn't have thought of studying how to write scripts this way!

A similar approach is with the book Shell Scripting Recipes: A Problem-Solution Approach by Chris F.A. Johnson. It will show you that certain things which on first look might seem hard to do with BASH are in fact perfectly manageable. See contents (http://ssr.cfajohnson.com/Contents.html) to get an idea. But I note that the book is not for total BASH beginners , it's more of a second book on BASH. (Or rather shell scripting in general.)