THE 30 ESSENTIAL ELEMENTS
FOR LINUX

Jeff Balvanz -- ISU Computation Center

January 24, 2002

When you teach a person how to use a computer for the first time, you have to teach them what they have to do as well as how to do it. They don't know what files and applications are, and that you need to copy them to diskettes or organize them into folders.

You, on the other hand, have been educated in what computers do, and are probably familar with how to do all the things that need to be done on a Macintosh or Windows machine. Your questions are more like those of someone driving a strange car: "Where's the headlight switch, and how do you turn on the radio?" That's where the 30 Essential Elements come in. You will find instructions for doing the thirty most common operating system tasks so that you can transfer your skills to Linux. This will get you up and running in Linux as quickly as possible.

This process is complicated by the fact that there are lots of ways to do the same thing in Linux. Unlike Windows or Mac OS, Linux gives you choices: a text-only command-line interface or a variety of graphical window managers. This is good. Brand new computers can use the beautiful desktop managers like KDE and Gnome. Older machines work better with a less demanding window manager like IceWM. Servers work best without the overhead of the graphical stuff, especially if you have three hundred of them without keyboards or monitors and want to manage them remotely. Finally, getting a command prompt and using the bash shell commands will almost always work no matter what window manager you're using.

For purposes of this document, we're going to assume that you have one of these four: the K Desktop Environment (KDE), the GNOME Desktop, the IceWM window manager, or the bash shell prompt. A text-only Linux installation will start the bash shell by default. If your computer starts up in graphics mode without giving you a command prompt, click on the icon at the bottom of the screen that looks like a terminal window and a bash shell window will open.

While reading, if you see a list with buttons under an element or subelement, it means that any of the choices will do what you want. Without further adieu, here are the 30 Essential Elements.

1. Turn the machine on and log in

Push the space bar or turn on the Big Red Switch.

Many Mac users are used to pushing the power key on the keyboard. Only the most modern PCs can start themselves up in this way, and they generally use the space bar. If you see a picture of a computer on the space bar, press it to turn the computer on. Otherwise, follow the keyboard cable to the box that is the computer and look for a power switch. In that case, you'll probably have to turn on the monitor by hand as well.

The big shock to Mac and Windows users moving to a Linux machine is that the computer, on startup, will actually ask you for a username and password and refuse to let you use it until you give it a correct set. If you don't have one, find the system administrator (or the person who installed Linux on the machine) and ask nicely for one.

2. See the disks on your machine

You can't, exactly.

Linux treats your entire system, including the network volumes you've mounted, as one big disk named "/". Underneath "/", other disks (like your floppy or CD-ROM drive) will appear as "mount points". Usually the floppy will appear as /mnt/floppy and the CD as /mnt/cdrom.

bash shell prompt: Type cat /etc/fstab. You'll get a list that looks like this:

LABEL=/                 /                       ext3    defaults         1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/hda10 swap swap defaults 0 0
/dev/hdb4 /mnt/zip250.0 auto owner,kudzu 0 0
/dev/fd0 /mnt/floppy auto owner,kudzu 0 0
/dev/cdrom /mnt/cdrom iso9660 owner,kudzu,ro 0 0

The "LABEL=/" entry is your main filesystem. Entries that begin with "/dev" are some kind of additional disk, with the second column describing the mount point, which is the name Linux will use to describe that volume.

KDE Desktop/GNOME Desktop: Icons should appear on the desktop for your home directory and any removable disks you have on your system. Additional hard disks and network volumes will appear as mount points, so those disks will appear in the /etc/fstab list as described above.

IceWM: IceWM doesn't display disks on the desktop. Right-click on the desktop and select "xterm" or "rxvt" from the menu that appears. You have just "started a shell". (You'll probably need to do this often, and many people set up IceWM to open a shell automatically on startup.) Now refer to "bash shell prompt" above.

3. Look at the contents of a disk

Mount the disk, then open it from the desktop icon or get a directory from the shell.

In Linux, disks have to be mounted before you can use them. You may or may not be able to do that; on many Linux machines, mounting a disk must be done by the administrator (called "root"). This promotes security, as people can't steal things from your machine and network if they can't mount a removable disk. So, try the following procedure to look at a disk:

KDE Desktop:

  1. Right-click on the disk icon and select Mount.
  2. Double-click on the disk icon.

GNOME Desktop: Double-click on the icon of the disk; GNOME will automatically mount it.

IceWM/bash shell prompt: If you're using IceWM you'll need to start a shell as described above. Next, you'll need to know what you're mounting, and where it gets mounted. Here are some choices:


Device Device Name Mount Point
Floppy disk First disk: /dev/fd0

Second disk: /dev/fd1

/mnt/floppy
CD-ROM Varies: usually /dev/cdrom /mnt/cdrom
Zip drive Varies: will depend on how your Zip drive is attached (usually /dev/hda2, /dev/hdb1 or /dev/hdb2 depending on how many hard disks you have and how everything is attached) /mnt/zip100.0 or /mnt/zip/250.0

Once you know how to describe it, you'll mount the disk with this command:

mount devicename mountpoint

For example, mounting the first floppy disk (drive A:, to the Windows users) looks like:

mount /dev/fd0 /mnt/floppy

Now that the disk is mounted, you can look at it.

KDE Desktop: click on the removable disk's icon or on the "Home" icon on the desktop.

KDE uses the Konqueror browser to display directories, Web pages and help files. When you click once on the icon of a disk, the contents of that disk will appear in a new window. If you click on the "Home" icon, the contents of your home directory (/home/username) will be displayed. The Konqueror window will look something like this:

Konqueror Directory Window

The left pane of the window shows the entire directory tree of your machine (beginning at "/"). If you want to see the entire root directory, click "Root Directory" in the left pane of the Konqueror window. Like Windows and Mac OS, different icons represent different types of file.

You can change the view of the window from the View menu with "View Mode". Your choices are as follows:

Icon View
Big icons with a filename below, arranged in one large group.
Multicolumn View
Big icons with a filename to the right in multiple columns.
Tree View
Small icons and filenames in a tree structure like the Windows Explorer or Macintosh View by List.
Detailed List View
Small icons and all the information about size, modification date, etc. in a list structure.
Text View
Like Detailed List View without the icons. Executable files are listed in different colors.

If you want to rearrange the icons (the Linux equivalent of the Macintosh "Special/Clean Up"), select "Sort" from the View menu. You can make it sort the icons by Name, Type, or Size.

GNOME Desktop: double-click on the icon of the disk to open, or the "User's Home" icon to open the home directory. GNOME Desktop uses the Nautilus browser as its file manager. A window like this one will appear:

GNOME Desktop Directory Window

Different file types are given different icons. The files can be shown in two different ways, selectable from the View menu:

View as Icons
Big icons with a filename below, arranged in one large group.
View as List
Small icons with information about name, size, type and modification in a list structure

Some of the icons in both KDE and GNOME Desktop have special meanings:

KDE (Konqueror) GNOME Desktop

(Nautilus)

Description
Gear Icon (KDE Binary) GNOME Binary Icon Executable binary file.. When you see an icon with gears, leave it alone unless you really know what you're doing. Removing it might break Linux or one of your applications. Fortunately, these tend to be concentrated in the directories /bin, /sbin, /usr/bin, /usr/sbin, and /usr/local/bin. Unless you are logged in as root or have become the superuser with the su command, you won't be able to modify or delete these anyway.
Icon of blank paper with terminal window GNOME Shell Script Executable script. Like a batch file in Windows, but the scripting language is much more powerful -- even better than AppleScript in Mac OS.
Icon of file folder GNOME File Folder Directory, containing files and subdirectories.

IceWM or bash shell prompt: if necessary, open a shell window. The shell starts with the current directory as /home/username.From the shell prompt, type ls to display a list of filenames in the current directory, and ls -l to display the filenames with their permissions, ownership, etc. You can display the information about a particular file by including the name in the command, e.g., ls -l linuxelem.html. Regular expressions can also be used in the filename to select more than one file. The question mark matches any character. The asterisk matches any number of characters, just like in the Windows command prompt, but the asterisk can be used at the beginning, end and/or middle of the pattern, e.g., ls -l *abc* would display directory information for all files containing the string "abc" anywhere in the filename. More complicated regular expressions are possible (and very useful), but their use is beyond the scope of this document.

4. Open a folder (subdirectory)

KDE/Konqueror: Click on the folder icon. To open folders above the current directory, click the Up button or select the folder you'd like to open in the directory tree in the left pane of the Konqueror window.

GNOME Desktop: Double-click on the folder icon. To open folders above the current directory, click the Up button.

IceWM/bash shell prompt: To change the current directory, type cd directoryname. To change the current directory to the directory immediately above the current one, type cd .. or specify the full pathname of the directory, e.g., cd /home/joeuser/MyDocuments.

5. Move a window

KDE and GNOME Desktop:

IceWM:

6. Resize a window

Mac users are used to using the manual resizer box in the lower right-hand corner of the window. You don't have to in most Linux window managers; you can resize from any side of the window, which is sometimes more convenient. But when you put your mouse pointer in a corner, dragging resizes the window in both directions just like the Mac's manual resizer box.

7. Maximize a window

It's written "Box/Button" because depending on which desktop scheme you're using it may be either a square box or a round button (or even something more esoteric). Note for Classic Mac OS users: the box on the far right end of the Title Bar is the Close Box, not the Zoom Box. Clicking there will close the application (darned frustrating). Most Linux window managers are compatible with Motif, which uses this three button scheme.

8. Minimize a window

Minimizing a window reduces it to a button on the Task Bar. The application is still running, but it's not cluttering up the screen. NOTE: some desktop schemes also have a fourth button to the left of the Minimizer box/button, which rolls the window up into the title bar.

9. Restore a window to its original size

If Maximized:

If Minimized:

10. Close a window and/or application

Closing a window shuts down whatever application was running it. Whether or not this happens gracefully depends on the application. Some will ask if you want to save your work before closing; others will warn you that there are unsaved documents and give you the opportunity to cancel; still others will simply lose whatever changes you've made. Be familiar with your tools.

11. Create a folder

KDE/Konqueror: With the window you want the folder to appear in open, do one of the following:

Konqueror will ask for a directory name. Type a name for the new folder and press <Enter>.

GNOME Desktop/Nautilus: With the window you want the folder to appear in open, do one of the following:

Nautilus will create a directory name named "untitled folder", with the name already highlighted for renaming.. Type a name for the new folder and press <Enter>.

IceWM/bash shell prompt: at the shell prompt, type mkdirdirectoryname, where "directoryname" is a simple name if the directory is to be created in the current directory, or an entire pathname (like /home/joeuser/MyDocuments/NewStories) if it is not.

12. Move files

KDE/Konqueror: Click, hold and drag the file over the window or folder you want to move it to. When you release the mouse button, a drop-down menu will appear. Select "Move here".

GNOME Desktop/Nautilus: Right-click, hold and drag the file over the window or folder you want to move it to. When you release the mouse button, a drop-down menu will appear. Select "Move here".

IceWM/bash shell prompt: at a shell prompt, type mv sourcefile destination where "sourcefile" is the name of the original file and "destination" is the filename or directory name to move it to. If you specify a directory as the destination, the file will be moved to the new destination with the original filename. mv is also used to rename files within the same directory.

13. Copy files

KDE/Konqueror: Click, hold and drag the file over the window or folder you want to move it to. When you release the mouse button, a drop-down menu will appear. Select "Copy here".

GNOME Desktop/Nautilus: Right-click, hold and drag the file over the window or folder you want to move it to. When you release the mouse button, a drop-down menu will appear. Select "Copy here".

IceWM/bash shell prompt: at a shell prompt, type cpsourcefile destination where "sourcefile" is the name of the original file and "destination" is the filename or directory name to copy it to. If you specify a directory as the destination, the file will be copied to the new destination with the original filename.

14. Delete a file

KDE/Konqueror:

GNOME Desktop/Nautilus:

IceWM/bash shell: at the shell prompt, type rm filename. In many Linux distributions you'll be asked to confirm the deletion, but not all. You can use regular expressions for "filename", but in those cases I recommend that you use the command ls filename first to be sure that the files to be deleted are really the ones you want (especially when you are logged in as root or are the superuser).

15. Recover a deleted file

KDE/Konqueror and GNOME Desktop/Nautilus: Open the Trash and drag the file back to the folder it came from.

bash shell: There is no easy way to recover a file that has been deleted with the rm command from a shell prompt.

16. Prepare a diskette for use (or erase all files on a diskette)

Disks must be formatted as the superuser, and usually only from the command line. From KDE, GNOME Desktop or IceWM you'll have to start a shell. Diskettes may be formatted either as MS-DOS diskettes (which may be used in both Linux and Windows machines) or as ext2-formatted disks. An ext2 disk can preserve Linux file attributes such as file owner and permissions; an MS-DOS diskette cannot.

MS-DOS formatted disk: formatting of disks must be done as the superuser. Type

su
fdformat /dev/fd0

mkdosfs /dev/fd0

The disk can now be mounted with the command mount /dev/fd0.

Another way to format MS-DOS diskettes is with the mtools set. Formatting a diskette as MS-DOS can be done by any user with the following command:

mformat a:

ext2 formatted disk: formatting of disks must be done as the superuser. Ttype

su
fdformat /dev/fd0
mke2fs /dev/fd0

17. Copy files to a disk

KDE/Konqueror and GNOME Desktop/Nautilus: Drag the file's icon to the disk's icon or to one of the disk's windows.

IceWM/bash shell: include the disk's mount point as part of the destination, i.e., cp filename/mnt/floppy/filename.

MS-DOS formatted diskettes only: at a shell prompt, type mcopy filename a: to copy a file to the disk in drive A:, or mcopy a:filename pathname to copy a file from an MS-DOS formatted diskette to a location in the machine's filesystem. You do not have to be root to use the mtools commands.

18. Open an application

KDE/GNOME Desktop/IceWM: Click the button at the left end of the Taskbar, then the application's menu choice.

Any window manager starting a windowed application: enter the application filename followed by an ampersand from a shell window, i.e.,

abiword &

This will start the application in a new window and leave the shell window available for other uses.

bash shell: enter the application filename. If the application can run in the background (like a server daemon) follow the filename with an ampersand to push the application into the background immediately.

19. Open a document

KDE/Konqueror: Left-click on the document's icon (or on a symbolic link)

GNOME/Nautilus: Double-click on the document's icon (or on a symbolic link).

Any window manager: enter the application filename followed by the document filename and an ampersand from a shell window, i.e.,

appname filename &

This will start the application in a new window, open the document and leave the shell window available for other uses. You will have to know the name of the application used to open the document, of course.

bash shell: enter the application filename followed by the document filename, e.g., joe filename.

20. Select a printer your computer already knows about

Linux lets you select printers by name. The printer names are set up by your computer's administrator. How you select it will depend primarily on the application, not the window manager you're using. For more detailed information, see "Using Central Printers from Linux" at http://www.ait.iastate.edu/pubs/lag320/lag320.pdf.

StarOffice/OpenOffice.org: select the printer from the pull-down menu in the Print dialog box. If your printer does not appear, have the machine administrator run spadmin to add your printer to the list.

KDE: KOffice applications can also select printers from a pull-down menu in the Print dialog box. Use the KDE Printer Configuration tool (available under the System part of the K Menu) to add printers to the list.

Other Graphical Applications: many older applications do not have a printer menu. Instead, a field in the Print dialog box is used to specify a printing command. Specify that command as lpr -Pprintername, where "printername" is the name of the printer as assigned by your system administrator or (if you're using the Iowa State Linux software) the Vincent system print queue name.

21. Print a document

KDE/Konqueror or GNOME Desktop/Nautilus: open the document and select "Print" from the File menu.

From graphical applications in IceWM: start the appropriate application from the Start menu, open the document using "Open" from the File menu, and select "Print" from the File menu.

IceWM/bash shell: at the command prompt, type lpr -Pprintername filename, where "printername" is the name of the printer or Vincent print queue and "filename" is the name of the document file. Depending on the print queue you're printing to, you may have to convert the file to PostScript or some other printer control language before printing. (If the print queue is using apsfilter or a similar "magic filter" to process the printer input, it should do any conversions automatically.)

22. Switch applications

KDE/GNOME Desktop/IceWM:

bash shell: There are two ways to run multiple applications from a shell.

23. Close an application that has crashed

KDE: Use the Process Management tool.

  1. Click the K Menu, then "System", then "Process Management".
  2. Find the application's name in the list under CMDLINE; click to highlight it.
  3. Select "Kill" from the Signal menu.

GNOME Desktop: Use the GNOME System Monitor.

  1. Click the GNOME menu, then Programs, then System, then Utilities, then System Monitor.
  2. Find the application's name in the list under "cmd"; click to highlight it.
  3. Right-click on the application's name, then choose SIGKILL from the pop-up menu.

IceWM/bash shell: at a shell prompt, type ps -A to display the current processes. Then enter kill -9 PID, where "PID" is the process ID number of the process to kill.

24. Shut down the machine

KDE:

  1. Choose "Logout" from the K Menu to log out of the machine.
  2. At the login screen, click "Shutdown" and choose "Shutdown" from the menu.
  3. If your machine cannot turn itself off, turn off the power when instructed to do so.

GNOME Desktop

  1. Choose "Logout" from the GNOME Menu.
  2. At the logout screen, click "Shutdown", then "Yes".
  3. If your machine cannot turn itself off, turn off the power when instructed to do so.

IceWM:

  1. Press <Ctrl/Alt/Delete>..
  2. Click "Shutdown".
  3. If your machine cannot turn itself off, turn off the power when instructed to do so.

bash shell:

  1. Become the superuser: type su and enter the root password.
  2. Enter the command shutdown -h now.
  3. If your machine cannot turn itself off, turn off the power when instructed to do so.

25. Restart the machine

KDE:

  1. Choose "Logout" from the K Menu to log out of the machine.
  2. At the login screen, click "Shutdown" and choose "Restart" from the menu.

GNOME Desktop:

  1. Choose "Logout" from the GNOME Menu.
  2. At the logout screen, click "Restart", then "Yes".

IceWM:

  1. Press <Ctrl/Alt/Delete>.
  2. Click "Reboot".

bash shell:

  1. Become the superuser: type su and enter the root password.
  2. Enter the command shutdown -r now.

26. Restart a machine that has crashed

Linux machines don't crash very often, though if a machine becomes very busy for some reason it may look as though it has crashed. Try the following things before turning off the power:

  1. Press <Ctrl/Alt/Delete> and if you're given the option click "Restart" or "Reboot".
  2. Try to start another virtual console. Press <Ctrl/Alt/F2>. Iff you see the screen clear and give you a login prompt, log in and restart the machine as in section 25.
  3. If the machine is set up for remote access via ssh or telnet, try connecting to it from another computer. Restart as in section 25 under "bash shell".

If all of these possibilities fail, you'll need to turn the machine off. If your computer has a "soft" power switch, try holding the switch down for 5 seconds; most machines with soft power switches will turn off even if they've crashed hard.

27. Connect to a network file server

Connecting to a campus AFS filesystem: you will need Iowa State Linux (available at http://linux.ait.iastate.edu) or a comparable afs client (like OpenAFS or arla) installed and properly configured. You must be logged in to Kerberos with either a Kerberized login (like the full installation of Iowa State Linux) or with the kinit command.. To attach a filesystem, start a shell prompt and enter the command attach filesystem, where "filesystem" is the name of the filesystem you want to connect to. Most of ISU's filesystems will automatically be mounted as /home/filesystem. If you'd like to put the filesystem at a different location, use the command attach -m mountpoint filesystem, where "mountpoint" is the full path to the mount point. (For example, to mount your AFS home directory as "afshome" within your local home directory, you can use attach -m /home/username/afshome username.) That directory must exist before you enter the attach command.

To disconnect a filesystem, use detach filesystem.

Connecting to a Windows file share: you must have the Samba client installed (see http://www.samba.org for more details). Start a shell prompt, become superuser with the su command and type:

mount -t smbfs -o username=username,password=password, uid=username, gid=samba //windowsserver/sharename mountpoint

where "windowsserver" is the Netbios name of the Windows server the share is located on, "username" and "password" are your username and password on that server (not the Linux machine), "sharename" is the name of the Windows file share you're mounting, and "mountpoint" is the mount point on your machine you want that share to appear as.

28. Adding a network printer your computer doesn't know about

If you're using Iowa State Liuux, you don't need to add the centralized (Vincent) print queues to your machine; just specify the printer name as described in element 20. Otherwise, you'll have to add a print queue. Here's how:

KDE: use the printconf-GUI. In the K Menu, select System -> Printer Configuration. Click Add, enter the root password and follow the directions. You can add queues that connect to UNIX, Windows and Novell printers as well as local printers and directly to HP JetDirect cards.

bash shell, Red Hat: become superuser with the su command and issue the command /usr/sbin/printconf-tui. Use the Tab key to select New, then enter the information as described above.

For more information on printing in Linux, see http://www.linuxprinting.org.

29. Repair a disk that has become corrupted

At a shell prompt, become the superuser with the su command. Then type /sbin/fsck device, where "device" can be a device name (like /dev/fd0) or a mount point (like /home, if it's on a different partition from your root filesystem).

For best results, a disk should be unmounted with the umount mountpoint command before running fsck. The root filesystem cannot be unmounted, but it is automatically checked at startup. If there are problems on the root filesystem that can't be repaired with the disk mounted, you'll have to start from a Linux boot disk or CD and run fsck on the unmounted disk.

30. Set the time and date

From a shell prompt, become the superuser with the su command, then enter the command date MMDDhhmmCCYY.ss, where "MM" is the numerical month, "DD" is the numerical day, "hh" is the numerical hour, "mm" is the minute, "CCYY" is the year, and "ss" is the number of seconds. Many of the parts of the date are optional; for example, date MMDDhhmm is sufficient to set the date and time to the nearest minute.

That's the hard way, however. The command rdate -s time.iastate.edu will set the system time using information from ISU's network time server, which is synchronized with the U.S. atomic clocks.

Getting More Help

The Linux Documentation Project: http://www.tldp.org
Help for new Linux users: http://www.linuxnewbie.org
Links to more Linux information: http://www.linuxlinks.org