Department of Computing Imperial College
Q&A on Linux: about DoC systems

How can I tell which OS version is running?
Is there any temporary disk space on the system?
How are the CD, zip and floppy drives used from Linux?
What about USB drives?
Can I ftp to any DoC systems?
Can I connect to the software archive (SunSite)?
How about sound drivers?
Is there any online documentation other than manual pages?
How do I use 'finger' to find out about other users?
The /vol directory appears to be empty?
X is taking up lots of memory?
Do CSG routinely kill processes which run for days and days?
What is the 'condor' process running on lab workstations?
I can't understand why I have exceeded my disk quota?
Another user got a "quota exceeded" message on trying to put files in my account.
How can I remove a file which is named in a way that rm cannot recognise it?
How can I leave a program running after I have logged out?
Why doesn't my program work?
How do I stop a terminal from echoing back characters?
How can I kill or bring to the foreground a job which is running in the background?
Why will cp not copy multiple files using * to several new files?
How does storage on /tmp work?
I have "limit coredumpsize 0" in my .cshrc file but I still get core files.
Is it possible to increase the limit on number of file descriptors?
Why does df show /var as often being more than 100% full?
Why does ssh ask for a password on Unix systems?
DoC workstations do not have multicast enabled by default.
How can I adjust sound volume?


How can I tell which OS version is running?

The following command will tell you what variety of Unix it is and which kernel version:

uname -a
On our Linux systems the file /etc/issue also indicates what variety of Linux it is. For example:
more /etc/issue

Mandrake Linux release 9.1 (Bamboo) for i586
Kernel 2.4.21-02doc on an i686
Also /proc/version has similar details.

(18/10/04)

Can I connect to the software archive (SunSite)?

Yes:

cd /vol/sunsite

(22/03/04)

Is there any online documentation other than manual pages?

There's more information on the GNU software in the "info" pages. You can read these via (X)emacs or by running:

info
or
info commandname
The emacs method is better, since you can follow the hyperlinks using the second mouse button.

How do I use 'finger' to find out about other users? Top of page

This is a command which returns information such as username, email address, 'phone number, room, etc. on anyone who has an account in the department. There is a also web version.

You can search for either a username, or real name.

For example, to search for a person having username abc96:

If you use the command frequently, you may find it helpful to put the following line in your .cshrc file:

alias f "finger /:\!:1@doc.ic.ac.uk"

This creates an alias which allows you to run the command by just typing:

f abc96

Please see the manual page for further options.

The /vol directory appears to be empty?

/vol is automounted. This means sub-directories will not appear on any given machine until a user has accessed them. Try cd /vol/lab or cd /vol/project etc.

Do CSG routinely kill processes which run for days and days?

Only if they come to our attention (eg: we receive a complaint about a process or we spot a process is taking a very large amount of CPU time). We try to make a judgement about a process as to whether it has gone "rogue" before killing it. If we are not sure about a particular process and it looks like the process might be connected with coursework or project work than we might reduce its priority and/or suspend it rather than killing it outright.

We are more likely to stop processes which are impeding the performance of the shell servers (shell1, shell2, shell3 and shell4) since these are intended for routine remote login by many users in the department.

How about sound drivers?

One of the CSG maintenance scripts maintains the sound configuration on all of our linux installations. If sound isn't working on your machine, than it could be because your computer is running an out-of-date kernel or because the sound hardware in your computer wasn't recognized.

If sound isn't working for you, send a mail to help and we'll investigate.

X is taking up lots of memory?

This isn't real memory. Most graphics cards now map huge amounts of registers and frame buffers to userspace which is reported as memory used. You can check this in /proc somewhere. 64MB is common, depending on the card, or even more.

How are the CD, zip and floppy drives used from Linux?

See the notes for Mandrake10.2 systems. The rest of this answer applies to older Linux versions.

Depending on which window manager you are using there may be icons on the screen to enable access to these drives. They can also be accessed from the command line. On Mandrake systems you need to 'mount' the drive first, and unmount (actually umount) afterwards. For example:

mount /media/floppy
cd /media/floppy
ls
umount /media/floppy
Other drives are probably named as follows:
/media/cdrom
/media/cdrom2
/media/zip
See /etc/fstab and /etc/auto.misc for details.

The drives can be accessed remotely, so if necessary you can put your disk into another system then ssh to that machine to read it.

When you finish with a zip disk, you should probably run the command sync in order to make sure everything gets written to the disk. You'll need to wait about 10 seconds before you will be allowed to eject the disk.

The mtools utility is also available.

(24/10/05)

What about USB drives?

See the notes for Mandrake10.2 systems. There is no support on older Linux versions.

(24/10/05)

What is the 'condor' process running on lab workstations?

Condor allows remote use of machines whenever they are idle (i.e. no keyboard or mouse movement). It should always vacate a machine that is in use.

Another user got a "quota exceeded" message when trying to put files in my account. Top of page

Disk quotas apply to the creator/owner of the files, not to the particular directory that the files are stored in. Unless the other user's home directory is on the same disk as your own, then it will not be possible to create any files in your account at all. If the directory is on the same disk, then he/she will be able to create files - but they will still count against his/her quota.
If you are trying to do some shared project work, then you can apply for some shared disk space on the /vol/project partition.

How can I remove a file which is named in a way that rm cannot recognise it? Top of page

Try a combination of the -i flag to rm (this will ask before deleting each file) and a pattern that matches the file that you want to delete.

Example: To remove a file called #gnu&! use:

rm -i *gnu*

This will generate a list of all filenames containing the string "gnu", then for each file, will ask you if you want to delete it.
The -i flag can also be used with the cp and mv commands.

Another situation might be a file beginning with a hyphen, e.g. -frame
As any argument to "rm" that begins with "-" is treated as an option, the following command won't work...

rm -frame

Use the - option with rm to indicate that following arguments are file names.

e.g.: rm - -file1 -file2

Or, there are other names referring to the same file that don't start with "-".
Example:

rm ./-frame

Also watch out for things like spaces at the end of filenames.

How can I leave a program running after I have logged out? Top of page

Most non-graphical programs can trivially be run in the background:

programname < input >& output &

Where:

< input
indicates a file containing all the input that will be needed by the program,
>& output
tells the system where to save the output from the program, and
&
indicates that the program should be run in the background; programs started like this will keep running after you logout.

While you are still logged in, you can look at the programs started during your current session by using the command jobs. Once you have logged out, to see the jobs again you will need to make sure you log back into the same machine as before, then use the command:

ps -x

If you start jobs up in the background, then please check on the jobs periodically to make sure that they are still running correctly, and that they eventually terminate. Jobs can be terminated using the command:

kill

Some programs don't survive a logout, however. You may need to use nohup to prevent the program committing suicide on logout.

Why doesn't my program work? Top of page

Generally speaking, for programming problems...

How do I stop a terminal from echoing back characters? Top of page

All terminal based programs are liable to modify the terminal settings to what they think is sensible. This includes the shell tcsh.

If you do not want these features, try running the C shell (just type csh at the command line). For more information about tcsh please read the manual page. There is a section on Terminal Modes, and there are a number of built-in commands for modifying tcsh's behavior.

I can't understand why I have exceeded my disk quota?

Have a look at our full page on disk space.

How can I kill or bring to the foreground a job which is running in the background? Top of page

To check which jobs you may have running on a given machine type:

ps x

To bring a job to the foreground:

fg % jobnumber

(jobnumber is the number appearing under PID in the output from the ps command as above)

To kill a job:

kill -9 jobnumber

The -9 flag overrides any protection.

Why will cp not copy multiple files using * to several new files? Top of page

In UNIX you can't use cp to copy a number of files in this way:

cp a* b*

as you can do with the DOS copy command.

This is because there is a fundamental difference between how DOS and UNIX handle wildcards. DOS copy would be passed two arguments with wildcards in and would then decide what these "*"s meant. Different DOS applications decide what "*" means according to what the programmer thought they should do. With UNIX, wild card expansion is performed by the shell, not the application, parsing the commandline in a uniform and consistent manner before it runs the application, passing the resultant list of files to the command one file to one argument. Therefore:

cp a* b*

in a directory containing two files beginning with a.. would have matched on the two a.. files but not on the b.. files, as they don't exist, and would have been translated to:

cp a1 a2

ie the command you asked it to do is to copy the data from a1 to a2, thereby overwriting the data in a2.

When using cp it is best to use the -i flag if you are not sure of the outcome of the operation; the command will then explain what it is going to do and give you the option to cancel:

cp -i a* b*
overwrite a2?

How does storage on /tmp work? Top of page

There is a separate /tmp (and /var/tmp) filestore on each individual machine. /tmp is allocated out of swap space - different machines are configured with different amounts of swap space depending on:

/tmp is not intended for storing very large files (several Megabytes or more). Filling up this area with files reduces the amount of swap space available for running programs. If /tmp is filled up then no-one will be able to use the machine and existing programs (or daemons) may die when they try to extend their memory usage. In extreme cases we may end up having to reboot machines as a result.

The df command will show how much space is available on each filestore, if you are storing large files on any of the temporary disks, you should try to make sure that you don't use up more than about half the free space at most.

Another thing to note is that the /tmp filestore does not support "sparse" files. On normal UNIX filestores, blocks are only allocated on the real disk when they are actually written to. If you seek to 1Mb into a file then write 2Kb of data, the amount of disk space taken up by the file is only 2Kb; however on the /tmp filestore the entire 1Mb will be used. This dramatically increases the amount of space used up by "dbm" files.

Under new Linux installations, /tmp and /var/tmp will be blanked on logout! You should use temporary file storage space such as /vol/bitbucket for less ephemeral data.

I have "limit coredumpsize 0" in my cshrc file but I still get core files. Top of page

I am not aware of any problems with the limit command with respect to its handling of the "coredumpsize" limit. I would expect the command you list to prevent core files from being generated.

A few possibilities:

Is it possible to increase the limit on number of file descriptors? Top of page

This can be done within some maximums imposed by the underlying operating system. Assuming that you use the default shell (tcsh), this can be viewed and modified by the shell command limit.

limit (show all your current limits)

limit -h (show the maximum values imposed by the kernel)

limit descriptors 128 (increase the file descriptor limit to 128)

When you use this command, it takes effect for any subsequent commands run by the shell in which the command was used. If you wish the increased limit to always be available, add the limit command to your .cshrc (or .tcshrc) file.

Why does df show /var as often being more than 100% full? Top of page

For optimal performance, the standard UNIX filespace requires that some space be left permanently free so that space can be allocated without things becoming too fragmented. Typically, 10% of the disk space is held in reserve for this purpose.

The percentage capacity shown by df is based on the amount of space available to ordinary users. "root" is allowed to completely fill the disk.

/var does occasionally fill up due to large quantities of files being created in /var/tmp, dumps following system crashes etc. There is no guaranteed way to prevent this from happening. We do try to keep an eye on the situation.

DoC workstations do not have multicast enabled by default.

All the DoC kernels are compiled with multicast enabled (there's no good reason not to), and in fact if you ping 224.0.0.1 you will find that multicast is indeed up and running in the labs.

Why does ssh ask for a password on Unix systems?

The user notes that if he does:

ssh-agent $SHELL
ssh-add
ssh machine ls
on any of the Linux machines, he does not get asked for a password. But if he does this on quail, it asks for a password.

We have moved to SSH protocol version 2. This uses DSA keys for authentication, meaning that your old RSA keys are no longer used. If you look in your ~/.ssh directory you'll see files called identity and identity.pub. These are RSA key files and it would be best to delete them to get them out of the way. Also get rid of the authorized_keys file.

Now you need to have a new style DSA key. This lives in files id_dsa and id_dsa.pub. Run 'ssh-keygen -t dsa'. Then copy the public key id_dsa.pub to a file authorized_keys2. The whole process mirrors that used for the old keypairs. To add your new key run 'ssh-add ~/.ssh/id_dsa'.

Then you should be able to ssh to any machine with that authorized_keys2 file (ie, any DoC machine) without giving a password. Run ssh -v to diagnose what is happening, you might like to try this now to see your old RSA key not being used.

It works from Linux systems at present because you don't need a keypair to ssh from one Linux machine to another. You have a Kerberos ticket and that can get forwarded. So you didn't notice that the RSA authentication wasn't working.

How can I adjust sound volume?

Try running 'alsamixer' (text-mode app) and muck about with the various volume levels - the main one (loudspeaker) that I modify is (on my machine) the second one ("Master M"), so you press right-arrow to select that column and then up-arrow and down-arrow to change the volume. ESC quits alsamixer.

© CSG / 2005