Unix for newbies

User avatar
nathanscribe

06 Apr 2012, 17:01

I know there are some very knowledgable folk around here, so I'd like to pick your brains a little if I may... for my sins I do most of my daily dabbling on OS X, and would like to get more out of Terminal - anybody have any recommendations for a (print) book to get me started? I've tried reading the man pages but if there's a proper physical book I can slob on the sofa/train/etc with, any pointers towards particularly good ones would be kindly appreciated.

User avatar
Charlie_Brown_MX

06 Apr 2012, 17:09

I found the best way to learn is noodling about, and exploring it. I also found switching over to mutt for my email taught me a lot as I worked out how to use it.

As for books, I found Unix Power Tools a great starter book, and still refer to it frequently.

I should add that I’m a total bumbler in *nix, an make frequent trips to Google and/or books to find solutions to problems that should be straightforward and simple.

User avatar
sordna

06 Apr 2012, 19:02

Just lookup some books that have decent reviews on amazon, perhaps "Unix for dummies" is worth a shot? I agree with the previous poster, best way to learn is to use it.
Try to actually DO STUFF on it. Want to move/rename/delete a file? Do it from the terminal. Want to create a directory (folder) ? Do it from the terminal. Want to write some notes? Do it in the terminal with console text editors. Then learn how to look for files or for content in files, learn some shell scripting, etc.

By the way, I recommend bash as the unix shell to use, that's the default on OSX anyway.
Do not, I repeat, DO NOT go anywhere near csh or its derivatives.
http://www.shlomifish.org/open-source/anti/csh/

User avatar
nathanscribe

06 Apr 2012, 19:44

Without doubt the best way to really get to grips is to use it, but I do like a book to read to help me get there. FWIW, I've never really got on well with the "dummies" series, but I've had a few SAMS and O'Reilly on various other topics, with mixed results. That Unix Power Tools looks like a pretty serious tome! I spotted the Nutshell guide from O'Reilly, and a few others - local bookshops don't seem to have much in the way for browsing, so I'll just have to take a plunge some time - so any you've used and can personally vouch for are always good to know of.

Thanks for the input so far chaps.

User avatar
Mrinterface

06 Apr 2012, 19:54

Go zsh........

User avatar
RC-1140

06 Apr 2012, 19:54

Definitely the best way is to learn by doing. Use the shell for everything you can use it for. ls, cd, mv, cp and rm are the most essential tools. Maybe you should have a look at tar as well, less, cat and tail are great tools too. And you should really start using console editors. mcedit (part of the midnight commander file manager) or nano if you're lazy, but if you really want to learn something useful you should have a look at this vim tutorial. vim is hard at the beginning, but the more you use it, the more you like it. Now I even take notes in school using vim. Some others recommend emacs, but in my opinion it isn't as logical as the modal system vim uses. Here's a really great vim tutorial: http://www.openvim.com/tutorial.html

And if you are more advanced, I really recommend you to have a look at the zsh (Z-Shell). It's a great shell, in most cases bash compatible, but the completion and the correction functions are far superior.

gorkypl

06 Apr 2012, 20:07

+1 to the above posts. I actually interact with *nix systems for a living, and despite I remember reading one book in the very beginning, the absolute majority of my knowledge was gained by just doing stuff. Online manuals, tutorials are really helpful in most cases.

User avatar
RC-1140

06 Apr 2012, 20:11

gorkypl wrote:Online manuals, tutorials are really helpful in most cases.

And manpages. Teach a man to use a shell tool and he knows one shell command more. Teach a man to use "man", and he knows how to use nearly every *NIX tool out there.

gorkypl

06 Apr 2012, 20:38

Ah, yes :) If you already know the name of the command you need, man is invaluable.

User avatar
Icarium

06 Apr 2012, 21:17

It also helps if you just use Linux. The less works the more you will be forced to use a terminal. ;)

User avatar
off

06 Apr 2012, 21:34

The command df is nice to know as well, not quite a tool, still quite valuable.

User avatar
RC-1140

06 Apr 2012, 21:52

off wrote:The command df is nice to know as well, not quite a tool, still quite valuable.
much better: "df -h"

"h" as in "human readable" ;-)

User avatar
off

06 Apr 2012, 22:20

RC-1140 wrote:"h" as in "human readable" ;-)
Ey man, don't spoil the surprise! He's got a lot of man-ning to do so might as well start there :P

User avatar
Charlie_Brown_MX

06 Apr 2012, 23:26

As everyone else has said, doing is the best way of learning. sordna and RC-1140 are both right: do *everything* you can via the terminal. Even file management. Once you get used to it, it’s much more efficient for certain tasks than the GUI:

Code: Select all

mv *.txt ~/Documents/Text\ Files
is a lot easier than hunting for, then dragging across, all your text files.

Anything you want to automate you can automate using shell scripts, and should. I learned a lot doing that.

I’m almost totally useless in vim, but I recommend learning it. It’s so powerful, and you can do some very advanced things very easily. It’ll give you the skills to use vidir, which is insanely good at working with directories of files if you want to rename them. (It probably does other stuff too, but that’s all I’ve used it for so far.)

Since you’re using a Mac, I recommend Mac Ports: it makes installing and removing packages so much easier. Also, Lingon makes creating and amending launchd tasks *much* easier.

User avatar
Gilgam

07 Apr 2012, 10:56

there was a book "Unox for macosx" or something like this.

But beware ! this will make you switchn to linux. This is what i have done, macosx, unix, then linux and i still use macosx on old machines, but that's all.

User avatar
7bit

10 Apr 2012, 16:50

This is a good start:
http://www.catb.org/

User avatar
nathanscribe

14 Apr 2012, 22:22

Thanks for the input chaps - I've decided to pick up one of the O'Reilly 'nutshell' books on bash/unix, and keep reading the manpages and dabbling...

User avatar
nathanscribe

02 Jun 2012, 18:47

OK, so I'm chipping away at this gradually, and learning what not to do.

Can anybody help me with something as basic as printing? I'm on OS X Lion, using Terminal (bash).

I've set up a printer, which is showing up just fine when I enter

Code: Select all

lpc status
, but when I try to print anything, for example

Code: Select all

lp test
(where test is a text file), I get pages of stuff that looks like code, header info, etc. and I have to cancel the job and turn the printer off and on again. I mean, pages of stuff - it just keeps coming. To the point where I have seven pages of junk and no actual file content yet.

Anybody know what might be happening, and how I just print what's needed? I can't seem to find any info online that helps.

User avatar
7bit

02 Jun 2012, 18:53

nathanscribe wrote:OK, so I'm chipping away at this gradually, and learning what not to do.

Can anybody help me with something as basic as printing? I'm on OS X Lion, using Terminal (bash).

I've set up a printer, which is showing up just fine when I enter

Code: Select all

lpc status
, but when I try to print anything, for example

Code: Select all

lp test
(where test is a text file), I get pages of stuff that looks like code, header info, etc. and I have to cancel the job and turn the printer off and on again. I mean, pages of stuff - it just keeps coming. To the point where I have seven pages of junk and no actual file content yet.

Anybody know what might be happening, and how I just print what's needed? I can't seem to find any info online that helps.
Did you try to print a PostScript file?

Usually it should just prinbt a text file as expected, but maybe the configuration is wrong.

Did you try lpr?

lpr -o raw file.txt

Did not try anything, because I don't have a printer at home.

User avatar
nathanscribe

02 Jun 2012, 19:05

7bit wrote:Did you try to print a PostScript file?

Usually it should just prinbt a text file as expected, but maybe the configuration is wrong.

Did you try lpr?

lpr -o raw file.txt
I have a simple file which I called test that is simply hello, world in pure text and nothing more. I generated it from the command line, not in a text editor, so it's as basic as it can be.

lpr gives absolutely nothing - no activity at all.

User avatar
captain

02 Jun 2012, 19:58

Best book ever written for Unix sysadmins:

http://www.amazon.com/Linux-System-Admi ... 0131480057

That's the Fourth Edition. I have to assume it is still as good as the first. I believe that Donald Knuth is quoted in there with something that constantly resonates in the back of my mind, "10 years of email should be enough for anyone." ;-)

Oh, and learn to use the command "apropos". Like "apropos printing", then RTFM.
Last edited by captain on 02 Jun 2012, 20:41, edited 1 time in total.

User avatar
7bit

02 Jun 2012, 20:35

If you have a printer connected, just post the config files. Also a link to a book is not helpful, he wants to print now!

User avatar
nathanscribe

02 Jun 2012, 21:04

captain wrote:Oh, and learn to use the command "apropos". Like "apropos printing", then RTFM.
:lol: If you mean, RTF Manpages, I have, but as a complete beginner I'm finding it easier to get going in some areas than others. There seems to be a lot of info about, but written for people who already know much more than I do... I'll get there, but not yet.

@7bit: for now I just uninstalled the printer, and will reinstall again - not even sure about those config files you mention, that's how n00b I am. I've already wasted plenty of paper on this, and even stopping the thing once it gets going has been a headscratcher. No doubt it's something fairly simple for those in the know, so I'll experiment further and report back.

User avatar
nathanscribe

02 Jun 2012, 21:45

Wrong driver selected during setup in OS X. Duh.

Still, now it seems to print one thing and then halts, ignoring all subsequent input. Hmm.

smknjoe

03 Jun 2012, 02:03

Which UNIX OS are you going to use (not OS X)? Since most UNIX systems are servers - set up server. I'd suggest starting with Ubuntu Server (with no GUI) since they have tons of experienced people on their forums and they are glad to help. You really need to just dive in. Once you get the basics down in Linux then move over to UNIX. O'R'eilly has a few nix books that are pretty good.

User avatar
TexasFlood

03 Jun 2012, 05:25

captain wrote:Best book ever written for Unix sysadmins:

http://www.amazon.com/Linux-System-Admi ... 0131480057

That's the Fourth Edition. I have to assume it is still as good as the first. I believe that Donald Knuth is quoted in there with something that constantly resonates in the back of my mind, "10 years of email should be enough for anyone." ;-)

Oh, and learn to use the command "apropos". Like "apropos printing", then RTFM.
Agree, back in the day the primary was always the Evi Nemeth System Administration Handbooks. After that we'd tend to have some O'Reilly books like Essential System Administration, DNS and BIND, Sendmail, TCP/IP Network Administration, etc. Depends on what your needs are.

ripster

03 Jun 2012, 05:45

Very apropos comment Captain!

User avatar
nathanscribe

03 Jun 2012, 11:06

smknjoe wrote:Which UNIX OS are you going to use (not OS X)?

[snip]

O'R'eilly has a few nix books that are pretty good.
At the moment I'm dabbling at home with OS X (Terminal.app), and the newly-acquired Raspberry Pi is running Debian, but I want to learn how to do things from the command line - I'm not doing this as a job, it's purely out of interest.

I've got a few books on my wishlist now, so no shortage of stuff to spend money on and time reading. :)

Post Reply

Return to “Off-topic”