|
|
Linux and Unix Q and A |
||||
October 30, 2000
Question 1:
A: Leaving aside the question of why you need to adjust the date to keep your S/W running, there is no standard 'only set the date' function from shell scripts; you have to set both the date and the time. Your method of finding the date and time then incrementing the date portion should work fine. It sounds more like you have a bug in your script than a problem with the operating system.
Here is a simplistic script (it doesn't check for the month changing!) that increments just the day:
Question 2:
A: I presume this is because you are trying to use a command such as s/ NSPay /
Question 3:
A: Well that debate could rage for a while!
Question 4:
A: I'm assuming here that you are trying to mount a filesystem shared out from an NT box so it is visible from Linux. SAMBA has components for working both ways, so you can share out Linux directories for Windows to mount, and mount Windows shares under Linux.
Question 5:
A: You can persuade Windows and Linux to share a single hard disk by partitioning the disk into separate areas and installing each of the
operating systems into one or more of these areas.
If you have an empty hard disk you can boot from a floppy disk (the
Windows 98 Emergency Boot Disk is good for this) and run the
FDISK program to create a partition to install Windows into.
You need to make sure that the partition you create does not entirely
fill the disk, to leave room for Linux.
If you already have Windows on the PC you need to resize the partition
that it is using. This can be done either by using a commercial product
such as Partition Magic, or the free utility FIPS. You can find a copy
of FIPS on most Linux distribution CDs.
As long as there is unallocated space on the hard disk, most Linux
installations will be able to use it. If you boot from the first CD of a
modern Linux distribution you will be able to direct the install to use
the free space, without disturbing Windows.
You can arrange to run either Windows or Linux when the PC boots
if you allow Linux to install LILO, its boot manager. I prefer to
arrange install LILO on the same partition as Linux (rather than the Master
Boot Record option), and make the Linux partition the "active" one by
using FDISK again - so that Linux boots by default. You can add
an option to LILO to allow Windows to be selected whenever you
need to return to the Microsoft world.
Your Linux distribution CD should contain documents that you can
read under Windows to learn more about installation before you
actually do it, so if some of the terms I've used are unfamiliar they
will be explained there.
Question 6:
A: I can only answer this question for a version of the C-shell available on Linux systems, but they may provide a clue if you are using another UNIX system.
The C shell uses a variable called "prompt" for the prompt. Essentially it just prints the value of this variable before reading the next command from the user.
You can set the prompt variable just like any other, so to get a
personal prompt you might do this:
ftp://ftp.astron.com/pub/tcsh/
Some versions of csh that do not have these sequences may respond to the
following 'hack'. You can set the prompt to be the current directory and
then define your own change directory command (cd) which resets the prompt
ans well as changing directory. Try putting this in your .cshrc file to
see it it works for you:
Question 7:
A: One thing that occurs to me is that the color depth may be set incorrectly. It is possible that your X is setup with configurations for 256 color mode, 65536 colors and possibly 16.7 million colors as well, since the Rage Pro is capable of all of these.
When you start X it has a habit of defaulting to the first color depth
it finds, and this may well be 256 color mode. If this is the case then X has to reduce the colors it uses to just 256. This results in grainy graphics,
especially if they have been designed to use more colors.
You can force X to use a larger number of colors by specifying the
color depth when you start X with start x. The option you need is bpp (for
bits per pixel), and you choose 8, 16 or 24 (for 256, 65536 or 16.7M colors).
This is a server option, so it has to be separated from client options to
startx. In practice you just need to type:
Question 8:
A: I assume you are running with the X Window System.
You can use xterm to start an application in a new console-type window.
Just use the -e option like this:
Question 9:
A: For a Linux-based server the minimum specification is probably something like this:
Pentium 200
386 20MHz
The best answer I can really give is "it depends what you need it to
do". Often you can get good results for a print server from very low-spec
servers, but a database server will benefit from lots of CPU power and RAM.
The approach top take is to try to think about the applications it needs
to support, the number of users, the predicted network traffic and try to
calculate what you need.
Question 10:
A: Try netstat -a
This lists all of the open sockets on a UNIX system, including those
waiting for connections. It also lists the port number being used by the remote
end.
Question 11:
A: The approach I would take would be to pull the files from the NT box to the UNIX box by using a program, such as mirror, that has been
designed for creating replicas of directory structures.
I would not attempt to push from the NT box as the NT FTP client is in
my experience very unreliable.
There is a Perl-based version of "mirror" that can run on any UNIX platform
that has Perl installed. It will FTP all the files in all of the directories
you need, and as a bonus will only transfer files that have changed next time you need to do it. You will need to setup NT with an FTP server.
Get mirror here: http://sunsite.org.uk/packages/mirror/
Question 12:
A: All you need to do is ensure that when you write the ISO image you set the burning S/W to make the image bootable. It's that easy.
Question 13:
A: Probably the best way, assuming you want to install Linux, is to appeal to the bottom line - i.e. it's cheap but reliable.
Start with a potential customer who only needs basic services,
such as file and print sharing, or maybe a basic Internet gateway,
and offer them a Linux solution that requires no license costs
and runs on smaller H/W than the equivelent M$ installation.
It's probably best to pick something that requires almost no user intervention,
so they don't get users complaining "It's not Windows. I don't know how
to..."
Once you get someone that accepts the offer, you can tell the next customer, "Client X of mine uses Linux, it saved them Y and they are finding it a very stable solution."
Question 14:
A: There are surprisingly few UNIX-specific books, probably because most UNIX vendors want to sell you courses or provide extensive manuals along with the operating system. There are also significant differences between the different vendors' versions. For Linux, which is much less fragmented, there is a wide choice. There are five books I'd suggest you look at initially:
For programming Linux, try 'Beginning Linux Programming' (Wrox Press) as a "get you started book."
Question 15:
A: If you mean, what does UNIX the abbreviation stand for,
the answer is that it is not an acronym, but rather a pun.
When UNIX was developed it was originally going to be an
operating system rather like one current at the time, Multics.
It would support just one user in the beginning, so the
idea was that is was "Uni" rather than "Multi", hence UNIX.
There are many different flavors of UNIX, but they generally
arise from idea in two main variants, known as BSD and System V,
which differ in a number of aspects, including terminal handling,
disk devices and some applications.
BSD was developed at the University of California at Berkeley
and System V by AT&T.
These days there has been a kind of re-integration with the
advent of the POSIX standards. Any system able to call itself UNIX
must comply with a UNIX standard (aka SPEC1170), although not
all conforming systems have been through the branding process.
If you stick to functions and applications defined in the POSIX
standard, your programs will run all variants (probably!).
UnixHelp has some information on UNIX variants and commands.
You can find it at: http://unixhelp.ed.ac.uk/index.html
Question 16:
A: Getting Linux to cooperate on an NT network is fairly easy these days. The SAMBA free software product is available for Linux and
many other UNIX-like operating systems.
With SAMBA you can share files, use NT printers and even act as a
domain controller. Most Linux distributions come with a version of
SAMBA ready to install. For more information see http://us4.samba.org/samba/samba.html.
The Wrox book, "Professional Linux Deployment," contains case studies
and step-by-step instructions for using SAMBA. More details can
be found at http://www.wrox.com/Consumer/Store/Details.asp?ISBN=1861002874.
Question 17:
1. I've created a folder in /bin directory as root, but it is inaccessible to other users. How do I make it available to all users?
2. During forking a process, how can I make the child process wait till the parent finishes its task completely?
3. By mistake, I installed a fishtank background as wallpaper and now I am unable to remove it. Help!
4. How do you install programs for Linux (such as an office suite) from
CDs available for free with magazines, for example?
A: To make a directory visible to other users, you must change the permissions. The chmod program can do this for you.
To make a directory readable to all users, do this:
chmod a+rx <folder-name
This also makes it searchable, which means users can see what is in
the folder, rather than just access files by name directly. Make sure
that programs you have stored are also executable by all users by doing this:
chmod a+x <program-name ...
To manage the termination of processes, check out the manual page for wait.
If Linux software is distributed in a package format such as RPM or
DEB files, you need to use the corresponding program to install them -- in
these cases, rpm and dpkg. If you are running Gnome or KDE, you can use a
graphical installer such as gnorpm or kpackage.
Question 18:
A: I think the Unix market place will narrow into a smaller range of players, with Linux being a significant part of that. The vendors who
have the strongest hardware offerings in the Unix server market will continue to be able to sell their Unix OSes, because when you are buying a 24-processor
server with 500 GB of RAID disk space, some money for the OS is not
significant. Plus, there are generally specialist tools, such as volume managers, that give you added benefits over Linux (at least at the moment). However, we are already starting to see some cracks. For example, Solaris 8 is "free" for systems with small numbers of CPUs (you still get to pay for media and shipping).
So, I think Unix in the wider sense will continue to have a strong
presence in the server market place. It's a stable, scalable and proven
platform. At the low end, Linux offers almost unbeatable price/performance. At
the higher end, the main vendors (such as Sun, IBM and HP) are generally trying
to sell hardware, so they can afford to drop the price of the OS. Microsoft has to make money from its software.
Question 19:
A: The short answer is that you are running the wrong editor. You should use Emacs :)
I'm assuming you mean a global replace throughout a file. Put yourself into the command mode: "ESC:". Then you specify the lines over which you want to replace. For the first to the last, use "1,$", then the substitute
command "s", then the old and new strings delimited either with a / or =
characters. Finally add a "g", if you want to replace all the occurrences of the string on a line, rather than just the first. So, to replace all occurrences in a file of the sequence "qwerty" with "xyzzy," you would type:
ESC:1,$s/qwerty/xyzzy/g
Many Linux systems use vim as a replacement for vi. Just type vi
without a file name, and then try ESC:help, and if it's vim you will get
to a tutorial.
Question 20:
A: On Linux, the answer is simply 'tar zxvf <filename' so I assume you mean on Microsoft Windows. The best tool is probably winzip.
See http://www.winzip.com for more information.
Question 21:
A: If you are happy looking directly at code, just download the Linux kernel and have a look! There may be descriptions in some of the
Unix/Linux books, but I don't know of a particular book to recommend.
Question 22:
Programs, particularly things like CGI scripts, are often shown as being
written to run on Unix. My question is: What percentage of Web servers use Unix as their operating system? In other words, if one wrote a script for use on Unix, what percentage of sites would be able to use it?
I hope you can help.
A: The answer to what sites run Unix or Linux is
reasonably easy. Have a look at the Web server survey on
http://www.netcraft.com. It's probably a good guess that almost all
the Apache sites are Unix or Linux, so that gives you
a rough estimate, say 60 percent to 70 percent, given that some of the other
Web servers are probably also Unix/Linux, excluding IIS, of course.
The second part, what percentage could you run a CGI script on,
is a different question, because many Internet service providers
are not going to let you upload a CGI scripts and execute those scripts on
their Web servers. Depending on the language you use,
Perl being a favorite, some will allow you, but they run the script
in a restricted environment. Without knowing the problem you
have in mind, I'd suggest a better solution: Rather than a
CGI script, consider PHP. Support for that is much more common,
and it's easy to learn. See http://www.php.net, which also has a list
of sites known to support it. Wrox also has a "Professional PHP"
book, which tells you quite a lot, and it will soon be joined by
"Beginning PHP," which is targeted at people just getting started
with dynamic Web sites. Oh, and it works under Windows as well... :)
Question 23:
A: Assuming you still have the floppy to get into Linux, then (as root) just run '/sbin/lilo' which will replace the MBR. If you have lost the ability to get into Linux at all, then boot from the Red Hat CD, with the options 'root=/dev/hda??? single' (where ??? is the partition where you installed Linux), and then run lilo as before.
You might also want to look out for a (Windows) program called loadlin,
which allows you to boot Linux from a DOS prompt in Windows 9x
Have a look round the FTP archives such as sunsite.unc.edu and
tsx-11.mit.edu , usually in the Linux-boot or dos_utils directories.
Question 24:
A: Now I must admit you have me stumped on that one. You can change the access and modification times with the 'utimes' system call, but there doesn't appear to be an easy way of correcting the creation time. Sorry.
|
|||||













