Welcome to the UCKFU network. This file is get you acquainted with the very basics of working on a UNIX system. The UCKFU network machines run variations of OpenBSD, NetBSD, and GNU/Linux. While none of these are classic AT&T UNIX operating systems, they are accepted as UNIX machines by most modern standards. This file is broken into sections that cover simple program introductions so that someone new to this type of system can hopefully find their way around relatively easily. While some level of computer understanding is to be expected, do not forget that as long as you have access to this system, you are never without the ability to open up one of the browsers and research away. If this file doesn't hold your answer, surely there is one somewhere on the net that does. First things first, you're currently reading this file by using the program less(1). You call this program by typing "less". The (1) denotes that the manual page is in section 1 of the OpenBSD Reference Manual. To access this manual page, you would type: man 1 less To continue reading this file, you can press pgdn/pgup to scroll down/up. When you are done reading, press "q" to quit. ================================================================================ CONTENTS 1. Knowing what shell you are using 2. Understanding some shell basics 3. Why is it important to use `which` 4. Who am I 5. Where am I? 6. Getting around 7. Text editing 8. Disk use 9. Mail 10. Requests ================================================================================ 1. Knowing what shell you are using: ---On the UCKFU network, you are provided with the following shells: bash, csh, ksh, sh, tcsh, & zsh. If you have used UNIX systems before, you most likely were using sh or ksh. If you have used BSD systems before, you most likely were using sh, ksh, or csh. If you have used GNU/Linux systems before, you most likely have used bash. By default, and due to its user-friendliness and extreme utility, the default shell for UCKFU users is ksh. To find out which shell you are using, you can do two things: $ echo $SHELL -or- $ ps | grep sh To see the shells available to use, do: $ cat /etc/shells If you wish to change your shell (for example, to bash), you should do the following commands: $ which bash | xargs chsh -s -------------------------------------------------------------------------------- 2. Understanding some shell basics: ---In the above command, the $ merely represents your login. Generally speaking (csh, zsh, tcsh, and others are exceptions), $ is used to denote a regular user login, and # is used to denote root login. By reading the manpage for the which(1) command, you can see that it: "locate a program file in the path". That means, which looks at $PATH, a special variable that tells your login where to find programs, and finds where the program you name is located. You can see what your $PATH is by typing: $ echo $PATH The resulting information is a colon-separated list of the places your shell will look for a file. The first place it is found "wins". So, now your shell knows the path to the program you are looking for (in this case, bash, which is /usr/local/bin/bash). The |, or pipe, is a special redirection tool for UNIX shells. It means to "take the output from the prior command, and make it the input for the next command". xargs(1) is used to move that input to the end of our argument. That is to say, that "which bash" returns "/usr/local/bin/bash". This is piped into the next command: "xargs chsh -s". That is the same as writing "chsh -s /usr/local/bin/bash". chsh(1) is the command to "change shell". So, by doing "which bash | xargs chsh -s" it finds bash, and then changes this to your shell. -------------------------------------------------------------------------------- 3. Why is it important to use `which`? Why can't I just do chsh -s /bin/bash? ---Paths to binaries are different on many different UNIX machines. While many GNU/Linux machines may hold bash in /bin/bash, other systems may use /usr/bin/bash, or even /usr/local/bin/bash. Just to make it interesting, a NetBSD (with pkgsrc) machine would hold it in /usr/pkg/bin/bash. So, "most machines" may hold the binary in the same place, it is a good UNIX habit to check the full path. -------------------------------------------------------------------------------- 4. Who am I? ---Outside of the existentialist question, it is good to know what user you are operating as. To see your current user, simply type: $ whoami Also, depending on the system you are on, you may instead (or also), use: $ who am i -------------------------------------------------------------------------------- 5. Where am I? ---Knowing your current location on the system is equally important. To see your present-working-directory (current location), type: $ pwd -------------------------------------------------------------------------------- 6. Getting around: ---Now that you know where you are, let's visit some basics of "moving around". To change your location, use "cd" (change directory). So if you would like to go to the directory /tmp, type: $ cd /tmp To verify that you are in /tmp, you may type "pwd". A shell-shortcut to get back to your previous directory is "-". So, now that you are in /tmp, if you wish to return to your previous location, you would type: $ cd - This is the same as using the ~- shortcut, only cd - will tell you the directory you just changed back into. If you just wish to get back to your $HOME (see echo $HOME) directory, you can type: $ cd ~ $ cd $HOME or just: $ cd -------------------------------------------------------------------------------- 7. Text editing: ---Now that you know how to get around on the system, you'd probably like to work with some files. The most popular interaction with a file is probably that of your text-editor. While there are many text-editors for UNIX systems, perhaps the most popular (and naturally the most featureful) are vi and emacs. While I'll allow everyone to choose their own favourites, I would highly suggest you take a look at something like the UNIX Text-Editor Rosetta Stone that I have been building at http://www.dayid.org/os/notes/editors.html. This is a good reference regardless of any editor you choose. That said, this system holds the following editors: ed, mg, vi, vim, emacs, nano, pico, and joe. ed is the most classic editor, followed closely by vi. Most new-to-UNIX users will find more familiarity in nano, pico, or joe; however, as time goes on, will most likely migrate to vi, vim, or emacs, to have accessibility to the largest featureset - and thus the most powerful editors. To launch any of these editors, simply type their name. To launch them ready to edit a file, do: editorname filename. That is to say, if I wish to create the file "myfirstfile", and I would like to use mg, I would type: $ mg myfirstfile At the end of my session when I save the file and quit, that file will exist. If "myfirstfile" already existed when I typed the above line, it would be opened to edit. -------------------------------------------------------------------------------- 8. Disk use: ---On the UCKFU network, each user is limited by quota to a segment of the disk, so that no individual user hogs space, making the system unusable to others. To see how much space is allocated for your user (and how much of it is in use), use the quota(1) command: $ quota To see how much disk there is in the entire system, you would use df(1) to display free disk space: $ df -h -------------------------------------------------------------------------------- 9. Mail: ---Long before e-mail existed (to extents), there was just "mail". The UCKFU network machines are equipped with: mail, mailx, alpine, and mutt. While as a new-user you may find mutt or alpine the most user friendly, don't overlook the power of mail for scripting purposes. That said, since UCKFU is run off of a residential connection, you should not expect to be able to send mail to users outside the system reliably. That is to say: mailing root will work, mailing bob@aol.com will most likely not. This is due to UCKFU being run off of DHCP and not having control of the reverse DNS. You'll need to setup your own SMTP/POP accounts if you wish to use them from this system. -------------------------------------------------------------------------------- 10. Requests, etc: ---If you have any requests for modifications to anything on any of the UCKFU machines, you should send mail to root on that system to make your request. -------------------------------------------------------------------------------- TO BE CONTINUED...