New User Schpeal

Welcome

Congratulations on entering the exciting world that is Linux! It is a world that is not always smooth, not always warm and cozy, but is essentially limitless and always rewarding. You will at times not be able to get some random thing to work, but do not despair and accept the challenge as a learning opportunity. Be ready and willing to read through a lot of documentation, web sites, mailing list archives, maybe source code, and if all else fails just try stuff. In your early times of using Linux, do not be concerned about breaking your machine. You can always reinstall if things go horribly wrong.

Read the above paragraph again... slowly.

Do not expect your first installation to be correct. You may find that you prefer your disk to be partitioned differently, or that you want different install options. Whatever. Expect to reinstall a few times. One installation tip... select "Development Packages" at the package selection screen, it will make your life easier in the long run.

Do not expect every program you want to be installed by default. There are tens of thousands of applications and libraries available in Mandrake, and it would be ridiculous bloat to install everything. I prefer to start with minimal initial installations and then install the programs I want afterwards. Installing new software in Mandrake is really easy... just see the urpmi page elsewhere on this site.

Although the graphical environments of GNOME and KDE offer a rich set of features and some very fine tools, do not eschew the incredible power of the command line. It is the command line that truly makes all Unix-like operating systems extremely powerful.

* Warning: failure to read this entire page before doing anything else may result in loss of key concepts!

Philosophy of Unix

Allow me to expand slightly on the first paragraph, specifically about turning a difficult situation into a learning opportunity. One of the main tenets of Unix is that programs and commands should be small, single-purpose utilities that can be combined and stacked in a variety of ways to suit the individual situation. In contrast, Windows and Mac programs tend to be very holistic applications that attempt to cover every possible need. But sometimes, you need to do something that the original developers hadn't conceived of, and made a button for. It may not seem so at first, but this difference between Unix and Windows/Mac is huge.

New users, accustomed to only doing what commercial software vendors have allowed them to do, usually have a hard time seeing this potential. And unfortunately, this potential does come at a cost: a steeper learning curve. To do a moderately complicated task in Windows/Mac requires one to push some buttons in a familiar interface. The same task in Unix may require some research to even locate the required utilities, then you have to read their manpages, learn some background information on the technical process, and finally figure out how these various utilities can be combined.

A good example is CD writing. In Windows, one might download Nero, click around a bit and get some work done in a short amount of time. In Linux, one needs to know a bit about how tracks are laid out on a CD, that there are two types of tracks: audio and data, maybe learn how to create an ISO9660 filesystem image or track offset info files, figure out the SCSI ID of your scsi-ide emulated drive, and finally burn the data to CD using either cdrecord or cdrdao. Of course, once you learn this stuff, and figure out how to use these tools _once_, then it is remarkably easy and powerful henceforth.

Create an ISO9660 filesystem from some directory and burn it in Unix:
$ mkisofs -J -R -o filename.iso /some/directory
$ cdrecord dev=0,0,0 filename.iso

The same in Windows:
um, double click that icon, and see that window in the upper left corner? no, not that one, next to it. yah. drag files from explorer to that window. not internet explorer, windows explorer... the file browser. with your right button. Now go find the "create joilet extensions" button and enable it. I don't know, in the preferences somewhere, I forget. ...

You tell me which is simpler.

Another example is file compression. The Windows world basically uses Winzip, which combines several files into a single archive and compresses it. The Unix world separates these two functions, and has several alternatives for both. tar and cpio basically cover the archiving functionality, and gzip and bzip2 cover the compression.

Let's combine GNU tar and ssh in a really useful way that was unintended by the ssh and GNU tar developers and send a large directory over the network, preserving it exactly (the \ indicates a line continuation, both of these should be one line):
$ tar czf - -C /some/directory | \
ssh hostname tar xzvf - -C /some/new/directory

Step 2: Let's add the GNU find command to send only files that were modified in the last 5 days and owned by user sarah:
$ find /some/directory -mtime 5 -user sarah | \
tar czf - -T - -C /some/directory | \
ssh hostname tar xzvf - -C /some/new/directory

A second principal tenet of Unix is that the OS shouldn't stop you from possibly really screwing up your system. If you load a gun, point it squarely at your foot, and pull the trigger, Unix's job is to absolutely deliver that speeding bullet directly into your unsuspecting foot.

It's unfortunate that the same protections against mistakes also guard us from creativity. (note to self: second tenet needs more work)

I'm going to stop now, because I think I've gone too far in the second section of the "newuser" page. I don't want to scare people with complexities. I just want to show some examples of *why* someone would bother with the extra learning curve of Unix.

Security

If you think security isn't important because "I don't really have anything important", or "Why would anyone want to hack me?", or "Who cares? I can reinstall my machines in an hour"... then you are WRONG. The reason security on *your* machine is important is not to protect *your data*.

Everyone on the Internet has at least one thing worth stealing... a network connection. To a malicious cracker, every network connection is a new place to launch an attack. Even if you have a 28k modem, your network connection is very valuable to a cracker!

You *MUST* do what you can to prevent your network connection becoming involved in an attack. You could be found *LIABLE*. When you connect to the Internet, you are part of a larger community that must work together. You owe it to the rest of us.

** will add security howto information

There should be...

Before you say "there should be ..." or "it should work like ..." and you are talking about some low level Unix thing, stop. Just because you don't understand the process, does not mean the process should change. Unix has been evolving since 1969 and has existed in forms ranging from the largest supercomputer in the world to the smallest. No other OS in the world can come close to Unix's longevity and versatility. Whatever it is, rest assured there is a reason :)

Obtaining Information

Now on to more important stuff. The most important command in all of Unix is simply 'man man', which will display the online manual page for the online manual pages! While reading any manual page, you can hit the space bar to display the next page and hit 'q' to exit. It's important to note that 'man' does not actually display the pages on the screen. It runs a "pager" called 'less', you can 'man less' for more information. The manpages are your first source for specific information regarding individual commands.

But what if you want more general information on some topic? The Mandrake community has put together a lot of Mandrake-specific information at mandrakeuser.org. And the greater Linux community's documentation project can be found at linuxdoc.org. At linuxdoc, you can find "Guides" which are long discussions on very general topics like "Linux Administration". You will also find the "HOWTOs" which are terrific for more specific topics like "CD Writing". The last truly great resource is google.com. That search engine is simply amazing. Have a random error message? Just copy & paste that message into google and see what it finds.

Note: When reading docs, try to read carefully; actually reading and understanding every word. Too many people have a built-in aversion to reading anything remotely technical and tend to "skim" over the material.

RPM

All software in Mandrake is organized in "packages" or "rpm packages" which can be installed, uninstalled, and upgraded individually. Now would be a good time to skim the rpm manpage, just type 'man rpm' at a prompt. Don't try to understand everything just yet. But look at the large number of options and the detailed explanation of everything. Don't be intimidated, you will understand all of this in time. I've written a simple RPM FAQ that I hope will help.

One of the unique features of Mandrake is 'urpmi'. It helps manage "collections of rpms" called "sources." Note that 'rpm' deals with individual rpm packages, but doesn't really know anything about other rpms that might be in the same directory. 'urpmi', along with a few related programs, store an index of all of the rpms in a directory. This directory can be on a CD, on an FTP server, or on your local hard drive. When first installed, 'urpmi' already has indexes saved for the three Mandrake CDs. If you have these CDs, you can just type 'urpmi xchat' and urpmi will locate the xchat rpm, any extra rpms that are required, and prompt you to insert the correct CDs. It doesn't get any simpler. I've written a simple urpmi FAQ that I hope will help.

Related to 'urpmi' is 'urpmf'. Someone tells you, "just type 'cdplay' at a prompt to start playing an audio CD", but when you type 'cdplay' you get "bash: cdplay: command not found". Your first guess is to type 'urpmi cdplay', but that just prints "no package named cdplay." What do to? Simple, just type 'urpmf cdplay' which prints "cdp:/usr/bin/cdplay". Great! 'cdplay' is in the "cdp" package... 'urpmi cdp' will then install the correct software.

Editing a text file

There are a *lot* of text files on a typical Unix machine. They store configurations for everything from your users' names and passwords, to your machine's hostname and IP address(es), your web browser's bookmarks, and countless other things. Your job as a Unix system administrator is to learn most of these files and be able to edit them quickly and efficiently. As you can imagine, Unix people have developed some very powerful text editors over Unix's 30+ year history. Some of these editors have GUI interfaces and require an X server. Others work in a terminal window or console. I *highly* recommend you get familiar with at least one terminal text editor. At some point in the future, you won't have X available and you will need to fix some configuration file.

My favorite text editor is 'vi' which can be found on nearly every Unix machine on the planet. Right now, type 'vi /etc/resolv.conf'. When you first open a file you are in "command mode" which assigns a unique command to almost every character on your keyboard including shift- and ctrl- key combinations. There's about 80 keys with commands, add the 160 combinations of all those keys plus ctrl and shift, and you get a *lot* of commands available. But wait, there's more! The ':' key drops you down to a command line within vi; that's even more available commands! Hit the 'i' key to change into "input mode", type some characters, hit the 'Esc' key to get back into command mode, hit 'u' to undo the changes. While in command mode, use the h,j,k, and l keys to move the cursor around the page. When you are all done playing around, change to command mode type ':q!' to quit without saving changes.

For some reason new users are very intimated by vi. If you fall into this trap and require something easier, try 'mcedit', or 'pico -w' (the -w is important, it inhibits pico's bad habit of adding extra newlines to structured text files). Note, there's no "pico" rpm, it's in the 'pine' package, so run 'urpmi pine' to install pico (*shrug* don't ask).

MDK9.1 update!pine no longer exists in the main Mandrake download edition because of its restrictive license. Instead, use 'nano', which is a full pico clone. But you can still find pine on the plf urpmi source.

Filesystem Basics

The filesystem is really the heart of any Unix machine. It all starts at the "root directory": /. Type 'cd /' and 'ls -al'. This will change the current working directory to / and print a long listing of every file and directory. On the left are the permissions (more about that later), in the middle is the owner and group assigned to that file, then is the size (in bytes), the date/time of the last time that file or directory was modified, and finally the file or directory name. Right now, skim over the 'ls' manpage.

Basic Filesystem Layout:
/--,  = "root directory"
   |-/bin  = user binaries required to boot the system
   |-/boot = kernel images, lilo, grub, and other files for bootstrapping
   |-/dev  = system device files, often the mount point for "devfs"
   |-/etc  = system configuration and rc files
   |    |-/defaults  = various default settings
   |    |-/rc.d      = all system init scripts
   |    '-/sysconfig = various configuration files
   |
   |-/lib  = system libraries
   |    '-modules = kernel modules
   |
   |-/home = user's home directories (almost everything non-root)
   |-/proc = the pseudo "proc" fs, lots of kernel-level status info
   |     '- /sys = various kernel run-time parameters
   |
   |-/sbin = system binaries required to boot the system
   |-/tmp  = temporary and scratch files, often cleared at boot time
   |-/usr  = everything not required to boot, almost a second "/"
   |    |-/bin   = almost all user binaries and programs
   |    |-/lib   = user libraries
   |    |-/libexec   = programs only ever executed by other programs
   |    |-/local = everything not distributed with mdk, almost a third "/"
   |    |      |-/bin  = local user programs not distributed with mdk
   |    |      |-/lib  = local user libraries not distributed with mdk
   |    |      '-/sbin = local system programs not distributed with mdk
   |    |
   |    |-/include = C headers for compiling programs
   |    |-/sbin  = system programs not required for booting
   |    '-/share = read-only architecture-independant files
   |           |-/doc  = lots of documentation from every rpm
   |	       '-/man  = manpages!  Most important files in Unix!
   |
   '-/var  = variable sized data
        '-/log   = log files

You can use 'cd' to move yourself around the filesystem. Feel free to look around. You can 'cd' directly into any directory by specifying the "full path", like 'cd /etc/rc.d/init.d'. Right now, read the first two paragraphs of the 'mount' manpage.

Here's some basic commands you'll need for getting around the filesystem:

And some slightly more advanced commands:

Root

What is root and how do you use it? root is the super user account on any unix machine. Only root has the power to change any file on the system. Only root has the power to totally fubar your system with a teensy tiny typo. Fear it, respect it, use it carefully and only when you need it. Should you log into X as root? *NO*! Log into X as yourself, open a terminal window, and type 'su -'. su will prompt you for root's password and open a new shell as root. Now you can type in any command you like with full root privileges. When you are done, type 'exit' to leave the root shell. This is the correct procedure for running commands like "rpm", "urpmi", "service", and "chkconfig". Any change that affects the entire system will require root.

New users tend to su to root the first time they need it, and then forget to exit and run too many commands as root. The most common example is downloading and untarring files as root. Pretty soon, the user has root-owned files all over the place that can't be edited without root. Now would be a good time to read the manpage for 'su'.

Java in Mozilla

The section was expanded and moved to here.

Finding Files

Unix has evolved several ways of finding files. I'll cover 'whereis', 'locate', and 'find'. The 'whereis' command searches a handful of common directories to find a command and its manpage. Type 'whereis urpmi', and it prints a few program names and manpages that contain the word "urpmi". When you have no idea where some command is located, try using 'whereis'.

The 'locate' command is excellent for looking for any type of file that can be any place on your hard drive. Type 'locate urpmi', and it prints lots of filenames, all of which have the string "urpmi" somewhere in their file name. You may be asking, "how does 'locate' get this information so quickly?", which is an excellent question. The answer is that 'locate' searches a small database of your entire hard drive. This database is updated automatically every night. If you want to use 'locate' for files that have been recently copied to your hard drive, then run 'updatedb' to update its database. Note, 'locate' may not have been installed on your system by default, just type 'urpmi slocate' and 'updatedb' to set it up.

The grand-daddy of all file searching commands is 'find'. It has many command line options to specify exactly *how* it should search for files, by name, size, and modification time. Then there are more command line options to specify what it should *do* with the file names. The general usage for 'find' is "find [path(s)] [option(s)] [test(s)] [action(s)]". One can specify each type of argument several times, but the overall order is important.

For example, the following find command would start searching in /usr, descend no more than five directories deep, look for filenames with "foobar" that have been modified within the last three days, and print the results.

find /usr  -maxdepth 5  -name foobar  -mtime -3  -print
     ^path ^option      ^test         ^test      ^action

This example is more complicated. Parentheses are used to group several tests together; the "-o" is a logical "or". This command will look in /tmp for files that aren't owned by "garrick" or "root", are plain files (neither links nor directories, etc.), more than 60 days old, and run rm -f on each one.
$ find /tmp ! \( -user garrick -o -user root \) -type f \
-mtime +60 -exec rm -f {} \;

Be sure to look at my urpmi FAQ page and look at the urpmf command for another important way to find files in Mandrake. And of course, all of these commands have manpages!!

identd

If you are coming from Windows, then you are accustomed to enabling ident in your IRC client. In the Unix world, we use the real ident daemon. The purpose of the ident daemon is far beyond that of IRC, which is why Unix clients never directly support it. On Mandrake, installing is trivial and requires no configuration. In a terminal window, type the following commands:
$ su - (type in your password) <-- of course you need root
# urpmi pidentd <-- install pidentd
# chkconfig identd on <-- run it at boot time
# service identd start <-- and run it right now

Keep in mind that ident is a service that your machine supplies for the outside world. Port 113 on your machine must be reachable from any machines that use ident to verify your identity. If you are behind a firewall, NAT router, ipmasq, or some other Frankenstein networking construct, you will have to find some way to get port tcp/113 available from the outside world.

Consoles and Terminals

The terminal is the basic interface to any Unix machine. In years long past, terminals were physical devices with little more than a CRT screen and a keyboard. These terminals typically connected to a Unix machine with a serial cable. Today's terminals basically come in two varieties, "virtual" and "emulated". When your x86 PC first boots, Mandrake (as do most Linux distros) starts six "virtual terminals" (VT). You can access each VT with the alt key and F1 through F6.

If you are running X (the GUI in Unix/Linux), the first X session is on F7, the second X session (you'd know if you started a second X session) is on F8, etc. When switching from an X session to a VT, you have to use ctrl-alt-F[1-6]. Since you are most likely reading this from a web browser in X, you can push "ctrl-alt-F1" to switch to VT 1, and then push "alt-F7' to switch back to X. Simple, eh?

In almost every window manager in Mandrake, you can right click on the background and get the application menu. In the "Terminals" section, you can launch an "X terminal emulator". Most Unix users work with several running X terminal emulators at once. Common examples are 'xterm', 'Eterm', 'rxvt', and 'aterm'. But my favorite is 'gnome-terminal' because you can easily "double right click" in the terminal window to open a second terminal window.

Things to do First

  1. Update your system! See the urpmi page on this site for getting all of the important system updates. Be sure to get the latest kernel too.
  2. If you are using an Nvidia video card, download and install their proprietary drivers.
  3. Download java and flash plugins. Installing java can be done by following the instructions elsewhere on this site. Flash can be installed by following the instructions at macromedia.mplug.org.
  4. Say hi to us in #mandrake on irc.freenode.net.
  5. Do whatever it is that you do on computers.

Back to Top level page

Flames and well-wishes to garrick@speculation.org
All content is © 2002-2004 Garrick Staples,
Registered Linux User #264142.
Valid XHTML 1.1! Cynthia Tested! Valid CSS!
Created with Vim! Powered by Mandrake!