Last modified on 27 JUL 1998.


Helpful Linux Information

You know, Linux is a powerful operating system, which is a bitch to maintain. I started with Slackware some four years ago but didn't get anything done because nothing worked and there were no information available (on how to obtain the information that had to exist somewhere) about how to set up your Linux. Two and half years ago I started to work at Tuorla Observatory and others set up the system (RedHat 4.2) for me. I must say, that although there are things that Windows does (much) better than Linux and others that you can not do at all in Linux, Linux is a dream-come-true when it comes to operating within Internet and creating and running your own programmes. For those of you who have just started your Linux life and those (like me) who need to be reminded of the simple things over and over again, I created this page of the simple Linux hints for beginners.



These bits and pieces of information are not in any sensible order. The bit you are looking for may be buried somewhere in midst of it all. Some of these things can be done in an easier way with some fancy RedHad5 X-gadgets, but should work in there as well.

Commands, Keyboard Shortcuts, and Definitions

Root is the almighty superuser of the computer. He can do anything (whilst most actions are forbidden from ordinary users) and can create or demolish user names. So don't make him angry - alternatively, if you are the root (e.g. in your own computer) don't let the power to get into your head.

/ is the symbol for the root directory
(root directory is the basic level of the directories, the "C:\" directory in Linux; e.g. cd / takes the user to the root directory from anywhere).

~ is the symbol for the current users own home directory
(the usual form /home/rareko can thus be written ~ by a user named rareko and ~rareko by other users; e.g. cd ~rareko takes any user to the home directory of rareko from any directory they happen to be in).

Command cd can be used alone in any directory to change to the user's own home directory (e.g. user rareko can go to his home from anywhere with the command cd instead of cd ~rareko or cd ~).

Command pwd shows the directory where you are at the moment.

Command w shows the users in the computer and their processes running (or being inactive) at the moment.

Command finger is similar to the w above but gives slightly different information.

Command top shows the currently running processes and updates the information until exited from.

Command rm deletes (removes) files just as del in DOS but there may still be weird files that start e.g. with -. These you can delete with rm -- "-filename.ending".

Command source .bashrc runs the .bashrc file after you have made modifications to it. Otherwise it is run when you boot your computer the next time. Command chown -R username directoryname changes the owner of directory directoryname to be the user username. This is mainly a root command but may be useful for ordinary users sometimes as well.

Command nenscript -B -fCourier10 -pPSfile.ps Filename.ending transforms your ascii file Filename.ending into a PostScript file named PSfile.ps that you can send to your PostScript printer. In X you can view these PS files with GhostView.

Command lpq -Pprintername shows you the printer's job queue.

Command lpr -Pprintername PSfile.ps sends your print file PSfile.ps to the printer.

Command lprm -Pprintername 666 removes YOUR print file with job number 666 from the print queue. Check the job number with the lpq command described above.

Command startx --bpp 16 starts your X-windows with 16-bit colours when normally you get only crappy 8 bits (256 colours). This can be done automatically as well, but those of you who wish to use IRAF or some other strange programme that requires 8-bit colours must settle with this command every time you use X without using IRAF.

Keyboard shortcut CTRL-L empties all the garbage from your x-terminal.

Keyboard shortcut CTRL-ALT-BACKSPACE kills your X-windows session.

Command man command opens up a manual (help) file of how to use the command command (e.g. man man gives you information on how to use this Linux help system. N.B. There is no way of obtaining a full list of Linux commands or a help that would tell you how to do certain job. This is one of the reasons Linux is so hard to maintain: once you know how to do something you can find about extra options but if you only know what you would like to be done, you are on your own.


One Linux feature makes your life much easier than it is in DOS. When you are starting programmes, copying files, or doing anything with filenames in the command line, you just type in the first one or two letters of the file name and press tabulator-key. This automatically fills in the remaining part of the file name. If there are lots of files which start with the same letters this procedure only fills in as far as the letters are in common with all those files. Then you just type in one letter more of the file name you want to access and press tabulator again.

If you are in the middle of something you can not or don't want to save at that moment, but would need to have an another connection, you can open a second (or third or fourth or ...) virtual terminal by keyboard shortcut CTRL-ALT-F1, where F1 is a function key from F1 to F6. If you are in X, the F1 is reserved and F7 returns you to where you were. Try not to start another X in a virtual terminal if you already have one running elsewhere.

One of the handiest features of Linux is how you can copy and paste text in and between windows. You just select the text you want to copy by "painting" it with the left mouse button kept in bottom. When you release the button the text is selected. Next you can move your mouse pointer to any window and click the middle mouse button (or both buttons at the same time if your mouse has only got two buttons). E.g. you can select text in text files, in system messages, or in Netscape, and paste it to your email or text editor.


Internal and External Devices

As default you must mount CD ROM and other similar devices after you have started your Linux, and you must unmount the devices after use. Here is what to do:
To mount your CD ROM put the CD ROM into your computer and give the following command mount -t iso9660 /dev/cdrom /mnt/cdrom where /dev/cdrom is the file (driver?) that you are mounting (check that the file in /dev really is called cdrom) and /mnt/cdrom is the location where you are mounting the CD into. Now if you go to directory /mnt/cdrom you actually are reading the contents of your CD ROM.
To unmount your CD ROM go out of any CD ROM directory (e.g. with command cd) and give the following command umount /mnt/cdrom. Now you can take the CD ROM out of your computer.
You may have to be the root to mount and unmount devices.

You don't have to mount and unmount your floppy drive. You can be a true Linux user and use it as a file or directory such as cp filename.ending /dev/fd0 (the last character is zero) or you may be a DOS addict and use the mtools commands mdir a:, mcopy filename.ending a:, mcopy a:\filename.ending, and mdel a:\filename.ending.

I have got an access to iOmega Zip drive both at work and at home. The following may heavily depend on the hardware and overall configurations of the computer but at least for me it works: To mount the Zip drive you have to have the SCSI installed in your kernel or in a kernel module. If it is in a module you should give the following two commands: /sbin/insmod /lib/modules/2.0.32/scsi/scsi_mod.o, where 2.0.32 is a directory with your current kernel version number, and /sbin/insmod /lib/modules/2.0.32/scsi/ppa.o. Next you can mount the drive mount -t msdos /dev/sda4 /mnt/zip (remember to have a zip disk in the drive when you do this). To unmount the drive after the use type umount /mnt/zip. Once again, you may have to be the root to do this.


Useful Scripts

1) Assume you want to copy all Filename1, Filename2, ... FilenameN files to be Filename1.fit, Filename2.fit, ... FilenameN.fit. You also want to get rid of the old files. You may give command mv Filename1 Filename1.fit for N times, but if N is tens or hundreds or more, you are better off with this script:
ls -la | awk '{print "mv " $9,$9 ".fit"}' | grep Fi This prints a line on screen for all N files:
mv Filename1 Filename1.fit, which you can copy and paste (see above) so that the lines are run as commands.


Computer and Internet Security

You may be aware of crackers and hackers. At least you should be. They may cause damage to your valued files or crash your computer. They are especially active in Linux world as Linux is free and every little cracker-to-be can get it and practise with it at home.
You should always make your connections with SSH and move your files with SCP. Using Telnet and FTP you risk letting unwanted visitors into your computer. If your computer is at home and you use modem to make your occational contacts to Internet, you don't need to worry about crackers too much. But if your computer is permanently connected to the Internet, you are in danger every second. At any time some cracker in Wyoming, Corsica, Romania, Pakistan, Malaysia, Easter Islands, or anywhere at all can try to gain access into YOUR computer. Once inside there is no telling what he might want to do.

To contact some other computer from your Linux computer use command: ssh username@computername.domain (e.g. ssh rareko@oj287.astro.utu.fi).
(To contact some other computer from your Windows computer use the ssh programme for Windows.)
To copy files from your Linux computer to some other computer use command: scp -pr * username@computername.domain:/home/username where -p is an option for copying the original dates and other information of the files, -r is an option for copying subdirectories, and * denotes for all files in the current directory. Instead of * you can give the file name you are copying and options -p and -r can be left out.
(To copy files from your Windows computer, be unhappy, for the creators of scp have not made a Windows scp yet. However, there is some not uncomplicated way of linking your Windows ssh and WinFTP together so that security is maintained. I have not tried this one out yet but when I do I'll include instructions here.)

System information of what is going on in your computer (in relation to the internet) can be found in /var/log where you should check the files messages, secure, and lastlog for any unwanted contact attempts or other unpleasantries.






Created by: Rami T. F. Rekola