Complete noob...
Nick Guenther
kousue at gmail.com
Sun Aug 6 21:01:31 PDT 2006
On 8/7/06, Woodchuck <djv at bedford.net> wrote:
> On Sun, 6 Aug 2006, Allie Daneman wrote:
>
> > The BEST docs are the man pages. They're the best ones I've seen and generally
> > get you going completely or started.
> >
> > P.S. BTW...try "exit" to logout ;)
>
> agree about OpenBSD's manpages -- compaired to other Unix versions,
> they are first rate. Compared to the documentation that came with
> Vax-VMS they are nothing ;-)
>
> Man pages are references, not tutorials. They are not really indexed.
Which is a bitch sometimes. Try finding out the definitions of certain
structs or typedefs or #defines by starting at code. PalmOS (where I
learned C) has a more convienient doc system (check it out:
http://www.palmos.com/dev/support/docs/68k_books.html). That said,
OpenBSD is much MUCH better because Palm has fallen prey to
Corporatitis and ShinyFlashyBuzzworditis and Linuxitis even. I've seen
OpenBSD's attitude in action and can tell it/they won't screw us over
in the long run.
> > > Here are a few examples of problems I am having, may sound stupid, but
> > > believe me I have spent hours on trying to get answers from the web
> > > and I am quite frustrated:
> > >
> > > Firstly, how do I log out! Stupid huh? I type "logout" and that
> > > doesn't work... and the the man page for logout looks like
> > > instructions for a programming function, doesn't help me at all!
>
> The man pages are divided into volumes, numbered 1-9. In the old days,
> they were printed out and bound that way. To see what each volume is
> about enter "man <chapnum> intro" where <chapnum> is a digit 1 through
> 9.
>
> Notice how "man 1 intro" leads you straight away to some documentation
> in /usr/share/. I'll talk about those soon.
>
> The logout man you found was in section 3, where library routnies
> for programmers are found. You are right.
>
> Why is there no Section 1 entry for "logout"?
>
> Because there is no "logout" command for the shell (sh or ksh) that
> you are using. Just like there is no "monkey" command, or a command
> "fix".
>
> Here are two hints into Unix: anything that "is" anything is a file.
> Your printer is a "file", you interface with it as a file. A directory
> is a file. A disk drive can be treated as a file. All devices are in
> some way or other a file. (This was a drastic simplification on Unix's
> part, there are OS's where this is not the case. Apple's pre OS-X was
> an example in a way.)
>
> By the same token, anything that *does* anything is a program. A program
> and the files that are its input, output and executable code is a "process".
>
> All processes are the children of other processes, except process number
> 1, named init.
>
> OK, so when you are signed on (logged in), you must be running a process.
> That process is called a shell. It reads from its input (your terminal
> device) and writes to its output (also your terminal). The shell process
> ends in a very logical way, i.e. when it is out of data. Since you
> are the source of the data, it ends when you send it a character signifying
> end of data. That would be Control-D. This is the end-of-file mark for
> character stream data in Unix. (You do not need to put it at the end
> of disk text files, BTW. Some lame OS's require that [MSDOS, CP/M]).
>
> So when you're done with your shell ("want to logout"), enter a ^D.
>
> When sh gets the ^D it closes its files and "exit"s. The death of a
> process is called a "death of a child" in Unix, and the parent is notified.
> The parent of your shell is a process named "init", pid 1. (see man init
> now).
>
> When your shell dies, init is signaled. Init then starts a new process
> called "getty" (see man getty), which is the process which issues the
> login prompts. When you login successfully, init sets your directory,
> starts your shell, and dies. (It has passed your shell process upwards
> to init).
>
> This long rap is to convince your that ^D, "end of file" "end of data",
> is the true, righteous and logical way to end your shell and logout.
>
> "man sh" would have told you about ^D, but you nothing but something
> like this email would have opened your eyes to the fact that you were
> running a program (sh) that runs until it's out of data.
>
Good stuff. Some of it should be added to afterboot, or at least a
pointer to this thread, methinks.
> > > Next how do I update the sytem to the latest stable? Sure there is an
> > > instruction here
> > > http://openbsd.org/faq/faq10.html#Patches but it really is not much
> > > help to me because it tells me to fetch the patch from from CVS or the
> > > errata page or wherever, but nowhere does it tell me HOW! so I am
> > > stuck...
>
> Wait for a little way until things have sunk in. There is no great
> change between 3.9 from the CD and the STABLE version of 3.9.
If he *is* coming from Windows (or even Linux) then you can't really
blame him for being antsy about upgrading... because you know...
hackers can hack so hard they can even kill your mom just by looking
at her, and security holes happen because you put too much strain on a
system and pieces of code start popping out like bolts on the titanic.
> > > I hope someone can help point me in the right direction to decent
> > > doc's, or give me some pointers, because I really like the philosophy
> > > of OBSD and want to use it, but I have spent a week on it already, and
> > > I am really battling to get anywhere. If I can't make progress soon, I
> > > will have to go over to Linux where there is more documentation for a
> > > noob.
>
> Why not just use the Linux documentation? MUCH is the same. Where do
> you think Linux/Gnu grabbed many of their ideas and a lot of the source
> code? BSD is older.
Because the linux documentation sucks? Linux documentation is mostly
in the form of HOWTOs. This is an awful mistake. What you need, in
order to make the most out of anything (but especially computers), is
the WHYs.
I ran linux for a year. Didn't teach me anything, and when it stopped
working (turned out I'd run out of disk space and X couldn't start; of
course I didn't know this because it was fucking configured to start X
from the startup script, and it took me another year to learn the
skills just to get the log of X crashing extracted) I failed and gave
up. Then I discovered OpenBSD. In a day of reading manpages I'd
learned more about Unix than in that entire year.
Oh, by the way, if you see x(n) it usually means "man n x", that is,
the manpage for topic 'x' in section n. I didn't figure this out until
months into my OpenBSD foray (yes I realize now that there is an
example of this in afterboot(8) but the notation is not pointed out).
Another useful tip is about 'export' (which I just learned myself
recently, embarrassing myself publically). With scoping rules like C
you have this:
block_outer{
var a;
block_inner{ /* a is accessible here */ }
}
but with Unix shell there is only block-level variables and global variables.
To make a variable global use the "export VARNAME" command
block_outer{
var a;
export b;
block_inner{ /* a is not accessible here, but b is */ }
}
You can use export in any of these ways:
A=val
export A
export A=val #equivilent to the above
export A #create A but don't put anything in it
Export can take more than one variable at a time, so you can also do this:
C=value3
export A B=value2 C
The practical result of this lets you install packages. There's lots
to choose from, and they can be fun to explore.
To install packages you must use pkg_add. If you set the PKG_PATH
variable to a path listing (in the same format as the regular PATH
var, that is, paths/urls with colons in between; see `man pkg_add` for
details). To let pkg_add read your PKG_PATH it must be exported
because PKG_PATH will not inherit your shell's local environment due
to the above rules.
Here is the line I add to my .profile file (which is run when you
shell starts up and is contained in your home directory, usually
/home/username/):
export PKG_PATH=ftp://mirror.arcticnetwork.ca/pub/`uname -s`/`uname
-r`/packages/`uname -m`/
(the `` means it takes the output of the command contained in the
quotes and substitutes it in, and uname is a utility for getting
operating system details, check `man uname`)
The full list of mirrors is at http://www.openbsd.org/ftp.html. You
can add multiple mirrors to the PKG_PATH if you want, just put a :
between each and make sure they all end with a /
You might want to add the root mirror to the end
ftp://ftp.openbsd.org/pub/OpenBSD/ because it is guaranteed to have
the most updated packages, and if the other mirrors fail this one
should always work.
Then go to http://www.openbsd.org/3.9_packages/, pick out packages, and just
pkg_add -iv pkgname
you don't even have to include the version number usually; if there
are multiple versions it tells you and then you can pick (the -i is
for 'interactive' and -v is for 'verbose', meaning it tells you extra
information)
>
> Tell us what your OS backround is, somebody here will be qualified
> to make translations from whatever it is to Unix.
>
> You should make a non-root account right now to use for learning.
>
> man 8 adduser
>
> Use it interactively, as root. It will prompt for entries.
> In general, accept the defaults for now, until you learn otherwise.
>
> Don't teach yourself Unix from a root account-- you will end up only
> teaching yourself how to re-install the system. Unix has no training
> wheels, never has had them.
That's not entirely true. I have been running a month cumulative as
root and have learned lots from it. I realize that I am running as
root and that things are different and I can adapt my knowledge. I
don't recommend you do this, though, for all the usual reasons
(smashey smashey being the biggest one). I just haven't gotten around
to learning sudo(1) properly yet. On the other hand, reinstalling
doesn't really matter; the official docs even say "be prepared to
throw away your first system". I'm planning on scrubbing this machine
this week anyway now that I've figured out a pretty nice set up (and
one that doesn't require the bloat of KDE):
ratpoison
mozilla
gaim
You can add these all with pkg_add btw, just use the name as I wrote
it there. Then you can do pkg_info pkgname or man pkgname (they don't
always install manpages, but they usually do).
> Don't bother with learning on a Linux system unless you're in a hurry
> and don't want to learn too much. They are all GUI-ish now and "learning"
> means memorizing click-recipes to some vendor's goofy idea of a "system
> interface", probably written in some nouveau-merde language like C++
> or something like python.
Python is hawt :) It's perfect for user interfaces.
C++ is smelly :(
But using either requires deviating from pure C. Sticking to as few
components in a system from top to bottom is a good thing, generally.
That said, most unicies nowadays come with at least C/C++, shell (in
various flavours), perl, and sometimes fortran or lisp though these
last two aren't used to write core components.
> > > I have looked in the archives and I see there a recent thread about
> > > documentation, and sadly the "powers" seem to believe the docs for
> > > OpenBSD are adequate. Well they may be for them because they already
> > > know all the stuff, but for me there is a HUGE gap for beginners. Note
> > > that I am a sysadmin with 8 years of experience on "commercial" ;)
> > > systems and so I am by no means a complete noob when it comes to
> > > computer systems.
>
> Trust me, they are right. So are you! The docs are adequate, you
> just haven't found them. You've asked where they are, now you're
> getting answered. All is right with the world.
>
> Unix was a major commercial system long before Gates started wanking
> around with his BASIC interpreter for a toy calculator. BSD is the
> linear descendant of one of those systems. I seem to recall 1976
> as Unix's birthyear. X-Window dates from the mid 1980's, BTW.
> Believe it or not, MS was on the original X consortium, and used
> this position to learn how windowing systems work. Then they screwed
> it up for the masses.
>
> This feeling of being lost is one *everyone* had. It seems to be
> part of the essential learning experience for Unix. I had to be
> *ordered* to learn Unix, for example. (I was a VMS sysadmin/engineer
> at the time.)
But it's so worth it :)
>
> BTW, learn the vi editor, no matter what anyone else says. Unless you
> have experience with a similar editor, this will be like pulling teeth,
> but when learned, it is the fastest text editor you'll ever see. All
> unix systems, biggest to tiniest, have vi. Learning this editor is
> a mandatory task.
"I'm not trying to start a flamefest but..."
let me provide an alternative. Since you, the newbie, are coming from
Windows, you are probably extremely used to notepad or at least
notepad-style editing. Try mg(1). It is emacs without being retardedly
bloated (well, it still hard a dired mode and some other things that I
consider bloat, but it's much much better than it could be). More
importantly it lets you type text normally without arcane commands.
When you need the arcane commands they are there for you, but
accessible via Ctrl and Alt sequences. mg seems to be sort of...
suppressed around here; from what I've seen the core developers are
all vi'ers, which explains it. I only discovered it quite by accident.
Don't do what I did and go installing nano though! nano is BAD. Nano
is trying to make terminal-editing user (i.e. newbie) friendly. If you
are working at a terminal you already deserve more respect than that;
besides, it takes up so much room onscreen with it's menubars and
things.
It does help to learn vi, especially if you will be going places where
there is no mg available (i.e. every other unix system ever) and you
can't get emacs (not that I'd want to get emacs either), but it will
*hurt*.
> Do you have X working yet? Do you have it working for *non-root*
> logins?
What's so hard about that...? The only difficulties you will have with
X are it's fucking config file, but that is well known to be Black
Magic. You will further reduce difficulties you might have by using a
simple window manager like <OOOH IT'S SO SHINY LOOK HERE
plug>ratpoision</plug!!! WOW EE>. I just did
# su kousu
$ startx
and it works fine for me too. What's so hard about non-root users?
Good luck.
-Nick
More information about the Openbsd-newbies
mailing list