3. How do I....?

3.1 How do I see the list of subdir in current dir (same as dir /ad in dos)?
ls -l | grep ^d
will do nicely

3.2 How do I sort (edit with sed, tr, grep, awk...) a file "in place"?
You can hide the intermediate file. E.g.:
Write a shell script called overwrite that looks like:

    -------- Cut here ------------
    #!/bin/sh
    tempfile=/tmp/`basename $0`.$$.$USER

    cat > $tempfile
    mv -f $tempfile $1
    #end script
    ------- Cut here --------------
and do sort file | overwrite file
overwrite is pretty buggy here - quick and dirty solution. Don't use it on "precious" files.

3.3 How can I use tar to extract just a few files from my archive?

3.4 How do I control an FTP session automatically?

3.5 How do I get pine to put my From: field correctly?
Note: This is assuming you are free to choose your username on the Linux machine you are mailing from. Since most of us are the sysadmins on the machine, it is a very likely assumption.
I'll show how to do it by way of example:
Your home machine is named, say ladybug.org.il
And your isp is math.huji.ac.il.
Your username, in both places, is moshez.
By default, your From field is moshez@ladybug.org.il.
Fire up pine, and in Main Menu, choose Setup, Configure.
The second line probably looks like:
user-domain = No Value Set
Change it to:
user-domain = math.huji.ac.il
(If you don't know how to do that, use pine's help).
Voila, you're done. Get ready for major spam now....

3.6 Why won't my winmodem work in Linux?
WinModems don't work with Linux. They require all sorts of software that hasn't been ported, and probably never will, so take the modem back to the store and get a decent modem.

3.7 How do I mount devices from user accounts?
You can specify in /etc/fstab that the device can be mounted by users, eg add this line in /etc/fstab:
/dev/fd0 /floppy ext2 rw,user,noauto,unhide

3.8 How could I eliminate the ^M of my DOS ascii files?
Use the programs "fromdos" and "todos".

3.9 How do I do to make Apache treat the files with extension *.htm the same as the *.html files?
Go to the httpd configuration directory where the file "mime.types" is stored. This could be /usr/local/httpd/conf or /usr/local/etc/httpd/conf or (for RedHat) /etc/httpd. Edit the mime.types file and find the line as follows:
text/html html
Add the following line to the file:
text/html htm
Restart your web server and you're done.

3.10 I can't seem to be able to redirect the output of the command.
It probably writes to standard error.
sh/tcsh, try the command:
command >& file
and in sh/bash/ksh/zsh, try:
command >file 2>&1

3.11 I've recently downloaded a program, and I don't have a clue how to install it.
Most programs come in source-form. When you have unpacked the source-code in for example /usr/local/src and entered the new directory created: read the README and INSTALL files (if present). They will tell you what to do; but the most common procedure for making the source into an executable and installing it in the right directory is './configure; make; make install' or just 'make; make install'.
If it's a RedHat package, rpm, or a Debian package, deb, then you should use rpm/dpkg. Try to use the package of the kind that belongs to your system - if you can't, then there are package convertors(e.g., alien, martian).

3.12 I need some of mail forwarded to another e-mail, unless it has "Hello" in the subject, in which case I want to auto respond and....?
Find procmail, in your favorite distribution, or from a sunsite mirror near you.

3.13 Why isn't my ls colored in RedHat?
The bash command alias 'ls=ls --color=auto' makes the ls command display a colour listing. Put it in your .profile or in /etc/profile.
In tcsh/csh, put alias ls 'ls --color=auto' in your .tcshrc/.cshrc

3.14 Is my modem a winmodem?
There are three things you can try out to answer this question :

1. See if setserial will find it.

2. Boot your PC using MSDOS (or switch to MS-DOS mode in Win9x) and try to access it using a standard, text-based terminal program like Telix or ProComm. HSP ("winmodem"} drivers do not work under DOS, only Windows, so these programs will be unable to access HSP-based modems. If you can connect to a remote site using one of these programs, or if you can even get your modem to respond to AT commands from one, the modem has a real serial port in it and should be usable with Linux.

3. Look it up on the list at http://www.o2.net/~gromitkc/winmodem.html .

Note that failure of the first two tests may be due to reasons other than the fact that your modem is a winmodem.


Back to Contents