Welcome to installment 3 of Clueless at the Prompt: A Column for New Users.
Thanks for the encouraging e-mail.In response to several requests, here is a little information to help you get your feet wet.
If you are familiar with that other windowing thing, you may be aware of the concept of multitasking. Using a single computer to do several applications at once is a highly desireable trait of an OS.
It's fairly obvious how to accomplish this in a windowing environment, but not so obvious at the shell prompt.Here's some of the details.
When you start a program at the shell prompt, you can stop it by typing
Ctrl-Z
Whereupon you will be returned to the shell prompt. Then type:
bg
which will restart thet program or job in the (b)ack(g)round and allow you to run another job while that kernel ccompiles, without changing to a different VC. You probably know that you can change VCs by using the
Alt-F2
through F6. Each one of these can also be used in the manner that I have described, to the extent that you can run yourself out of resources in a fit of deep hack mode euphoria if you aren't careful.If you get really exuberant you could even forget what all you have going. Relax, you can find them all by typing:
jobs
which will list all jobs running in the background, much like the
ps
command lists all processes that are using your precious memory and CPU to a nub.
When you boot up linux your file system or rather your hard drive must be mounted, so that the file system can be read and acted on.Your floppy drive, tape backup, or CD-ROM may not be automatically mounted, so you could have need of the mount utility.For instance:
mount -t ext2 /dev/fd0 /mnt or mount -t msdos /dev/fd0 /mnt
will mount your floppy drive that dos calls a: to a directory called /mnt from where you can access files on floppy disks. In the first example, the /mnt directory can be read in the ext2 filesystem, while the sescond reads floppies written in msdos format.To read the contents of the floppy drive, which is now /mnt you can type:
cd /mnt
then,
ls
or
less filename
In a similar manner, you can mount your other floppy drives, tape drives, CDROMs, or other read write devices.These devices can be unmounted using the
umount /dev/fd0 or /dev/whateveryoumounted
command.
Here are a few tips that can make your linux life a little easier.
When you first logon to linux there are some commands that make use of optional switches,which you may not know or be sure of. You might make a typo in your command that you don't catch until after you hit enter. To try it again without retyping the whole command, just tap the up arrow key, which will bring back the previous command so that you can return to the scene of the crime and replace the mistyped or mistaken characters. In fact if you tap enter several times you can go back to what you did several commands previous.
To change back to a directory you have just left, or to scan subdirectories, you can use :
c -
in the following manner. change from your /home directory to the main trunk directory:
cd /
then, to look at the top level of each directory, for instance:
cd usr
then:
ls
If you didn't find what you were looking for, just:
cd -
and you will find yourself at the trunk / again. Unfortunately you can only go one layer deep, but it is still useful when you install a source package and want to check out the contents of each of the subdirectories. Sometimes, atleast at first, you may not know how to stop a program or process that's running, but you are unwilling to let it slowly eat up your memory or CPU overhead. You can type:
ps -a
to get a list of all running processes, make note of the pid (Process ID) number and type:
kill pidnumber for instance kill 2395
But there is an easier way. Browse through the LSM (Linux Software Map) for a utility , actually a nicety called die-1.1 . You can unpack this into a directory or use installpkg dopkg or what ever your single package installation utility is. Then look for the /die-1.1 and cd to it. It contains a couple of files, a source file,
die11.c
and a documentation file,
die.doc
Assuming that you installed the GCC compiler, just type:
gcc -o die die11.c
hit enter and presto you've compiled a utility called die.Just mv this to a directory in your path, and if you like, mv the die .doc to /usr/doc or somewhere it can be with its other help text friends( but not man pages they'll pick on it unmercifully).Next time you're in a quandary about how to gun down a process just type:
die commandname
and it will do the deed. To find out more about die just type:
die
with no argument and it will give you a summary of the commands you can try the up arrow keys on
I guess I made a mistake when I said I made a mistake about the mkdir command in DOS. Several people sent me mail that mkdir -md, rmdir-rd and a couple ohers are synonymous with linux commands. One fella told me he made symbolic links to several DOS commands so he can use them without having to learn new but similar commands. Sick, but ingenious.
TTYL, Mike List
Clueless at the Prompt #1 - February 1997
Clueless at the Prompt #2 - March 1997