ALINK="#FF0000">

"Linux Gazette...making Linux just a little more fun!"


Getting Started with Linux

Version 1.0 November 98

By Prakash Advani


This document is written for people who have just installed Linux but don't know what to do next. Most of the commands discussed here should work on all distribution of Linux but since I use Red Hat 5.0 some of them may be specific to Red Hat 5.0. I have also used Caldera OpenLinux 1.3 and have included some Caldera specific information. If any of you have any suggestions or ideas to improve this document, they are most welcome. All commands are in quotes and you need to type them without the quotes. For example if you see type "ls" then you just need to type ls. You will also have to press the ENTER key after typing each of the commands. There are some useful commands in the document but for complete command reference you will need to refer to additional documents.


Let us begin with first booting into Linux. When you boot Linux, you will see a lot of messages coming up. You need not understand all of them right now but if you get some errors while booting, you may want to look at them. These help in understanding them and do any troubleshooting if required. First thing you must do is login in to your Linux system. At the login prompt type "root" (or whatever username you have created) and put in the password. The password is selected at installation. If you installed linux on your machine then you are the root user and you have supervisory access to the system. If you didn't choose any password then the system will not ask for a password, instead take you straight to the Linux prompt. You will now come to the Linux prompt. The prompt will be a # if you are root or will be a $ if you are some other user and have chosen the BASH shell. If you are new to Linux then you should use the BASH shell. Out of several shells under Linux, I prefer BASH because it is easy to use. BASH is also the default on most Linux Distributions. Your prompt may look something like.

[root@yoom.com /root]#

If you need to logout just type "exit".

Once you have logged in type "dmesg" to see the bootup messages. You will see something like:

Serial driver version 4.13 with no serial options enabled
tty00 at 0x03f8 (irq = 4) is a 16450
tty01 at 0x02f8 (irq = 3) is a 16450
Real Time Clock Driver v1.07
hda: QUANTUM FIREBALL_TM2110A, 2014MB w/76kB Cache, CHS=1023/64/63
hdc: CREATIVECD2421E, ATAPI CDROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
Floppy drive(s): fd0 is 1.44M
FDC 0 is a post-1991 82077
md driver 0.35 MAX_MD_DEV=4, MAX_REAL=8
raid0 personality registered
DLCI driver v0.30, 12 Sep 1996, mike.mclagan@Linux.org.
Partition check:
hda: hda1 hda2 < hda5 hda6 hda7 >
VFS: Mounted root (ext2 filesystem) readonly.
Adding Swap: 16092k swap-space (priority -1)
Soundblaster audio driver Copyright (C) by Hannu Savolainen 1993-1996
SB 3.1 detected OK (220)
sb: Interrupt test on IRQ5 failed - device disabled.
YM3812 and OPL-3 driver Copyright (C) by Hannu Savolainen, Rob Hooft
1993-1996
sysctl: ip forwarding off
Swansea University Computer Society IPX 0.34 for NET3.035
IPX Portions Copyright (c) 1995 Caldera, Inc.

You will realise that the messages scrolled down before you could read them. To see them page by page type "dmesg | less" or "dmesg | more".

The dmesg command provides valuable information about the hardware devices detected by Linux. It also helps in knowing if there was some problem somewhere. Like if you see the line: sb: Interrupt test on IRQ5 failed - device disabled. It means there was a problem with setting up of the Sound Blaster sound card at IRQ5. If you get such errors, it may mean that some of your hardware is not working correctly under Linux.

The BASH shell has a lot of ease of use. If you like working a lot on the command line, you will find it very easy. The bash shell allows using the previous command by press the up arrow key. You can also search for previous commands by typing "CTRL-R" and typing some words from the previous commands. To clear the screen press CTRL-L or simply type "clear".

Another important command is df. Just type "df" and you will see something like:

Filesystem	1024-blocks	Used	Available Capacity	Mounted on
/dev/hda6 388362 341804 26501 93% /
/dev/hda5 614672 572176 42496 93% /dosd

This gives information of all your mounted hard disk partitions, available space and used space. The space shown is 1024 blocks which is 1024 bytes or one Kilo Byte. It also shows at which directory the partition is mounted. Like in DOS and Windows partitions and devices are allotted drive letters such as C:, D:, E:; in Linux partitions or devices are mounted onto directories. For example /dev/hda5 is mounted on /dosd. Normally /dosc, /dosd, would be your mounted dos partitions. It could also be anything else. Which means you can access your Dos files through Linux by going through these directories.

Another useful command is ls. Type "ls" and you will see something like:

bin/ dev/ etc/ lost+found/ proc/ tmp/
boot/ dosc/ home/ mnt/ root/ usr/
cdrom/ dosd/ lib/ opt/ sbin/ var/

Type "ls -l" to see a more complete list. This will show the owners, permissions, date and time of when last modified and file sizes. You will need to understand file permissions once you get the hang of the basic Linux operations. Permissions are useful for multiuser Linux system where you need to restrict or allow access to files or directories.

drwxr-xr-x 2	root root 2048	Sep 17	12:49	bin/
drwxr-xr-x 2	root root 1024	Oct 4	23:24	boot/
drwxr-xr-x 2 root root 1024 Sep 2 17:32 cdrom/
drwxr-xr-x 3 root root 21504 Oct 22 12:54 dev/
drwxr-xr-x 2 root root 1024 Oct 2 21:59 dosc/
drwxr-xr-x 13 root root 21504 Jan 1 1970 dosd/

The cd command is used to change directories, you can try by typing "cd /" to go the root directory. Type "cd -" to return back to where you were. If you just type "cd" you will return back to your home directory. Installing softwares, opening compressed files under Linux.

If you download documents, utilities, softwares or anything else for Linux, you will find that a lot of them have extensions of .tgz or .tar.gz. In that case you will have to type the following command to extract the files. Replace filename.tar.gz with the name of the file.

gzip -dc filename.tar.gz | tar xvf -

If you downloaded some Linux files under DOS, chances are that the file names may get truncated. In that case you will have to rename your files before extracting them under Linux. To rename files just type "mv oldfilename newfilename". Replace oldfilename with what the current file name is and replace newfilename with what you want the file name to be.

Several files are also in the .rpm format. These formats are for the Red Hat and Caldera distribution and they are also used by other distributions. To install rpm's type

rpm -i filename.rpm

If you are upgrading an existing software type

rpm -U filename.rpm

If your distribution does not support RPM's you can add that support by installing the RedHat Packet Manager (RPM). Similarly there is pkginstall under some distributions to manage .tar.gz files.

Man Man! What's man man ? These are help pages or manuals to get some help on a specific command. To get help on man type "man man". Similarly to get help on rpm type "man rpm". To get help on ls type "man ls" and so on. You can get help on all the command using man. To begin with get help on commonly used commands. These commands will help you move around files and directories. Some commonly used commands are:

cat	To type the content of a file
cp	Copy files
du	To check the disk space used
pine	Email client
find Find files on the linux system
grep Search for keywords on a file or a command kill To kill any process, ps to see the process number less If you cat a file you can pipe it to less for page by page viewing ln Create or remove links between files or directories
lpr Print files or output to a printer
ls List files or directories mkdir To create a new directory
more Similar to less but less is better than more! mount See the mounted devices or mount additional devices umount Unmount mounted volumes
mv Move or rename a file
passwd Change your password ps To see the processes running
rm Remove files or directories
rmdir Remove directories
useradd Add a user to the linux system userdel Delete a user on the linux system
usermod Modify a user on the linux system
which Find where a program is located
who Displays the users logged in
zless To see the content of a .gz file (compressed)

Some more tips for bash users. If you know that the first letter of a command for example is a but don't know the rest type "a" and then press TAB twice and bash will show the list of possibilities. You can also press a single tab to complete a command if there is only one possibility. This saves a lot of typing time. Example type "mou" and then press TAB, bash will put mount on the command line.

Pressing TAB twice shows all the Linux commands. It looks something like:

There are 1212 possibilities. Do you really wish to see them all? (y or n)

Type "y" and you will see all of them!

Sometimes if you type a command, the screen may scroll by too fast for you to read, unless you are superman. In that case you can see the previous screen by pressing Shift and PG-UP keys together.

If you type some commands, you can break by pressing CTRL-C or ESC. It may not work in man or less, in that case just type "q".If you need to edit some files try pico or joe. These are two easy to use editors. Joe works more like WordStar and pico is the editor for Pine. Power users may try vi or emacs. These two are very powerful editors but have a high learning curve. Examples would be type "joe filename". Replace the filename with the name of the file that you wish to edit.

Most distrbutions install X-Window. To start X-Window type "startx". X-Window is a GUI for Windows. There are several flavours available which give you different look and feel. To configure a redhat system type "setup". If you are under Caldera type "lisa". You can also configure through a GUI interface under X-Window.

Most users may want to use some dos floppies or partitions. You can type some dos commands under Linux without mounting your devices. Type "man mtools" to see a list of these commands. These commands start with m, example the dos copy command would be mcopy. Similarly there are several commands such as mattrib, mcd, mcopy, mdel, mdeltree, mdir, mformat, mlabel, mmd, mrd, mmove, mren, mtype, mzip, etc.To see some more Linux documentation's look under the following directories. If the files have .gz extension the to view them type "zless filename.gz" replace filename with the name of the file.

/usr/doc/FAQ
/usr/doc/LDP/install-guide
/usr/doc/mini/usr/doc/HOWTO

 

Prakash Advani is an Internet and Systems consultant based in Mumbai, India. Currently we are setting up a Web site dedicated on Free Operating Systems [www.FreeOS.com] including Linux. Any help would be greatly appreciated.

 


Copyright © 1998, Prakash Advani
Published in Issue 35 of Linux Gazette, December 1998


[ TABLE OF CONTENTS ] [ FRONT PAGE ]  Back  Next