Next Previous Contents

3. Linux Software Most Frequently Asked Questions.

The following sections answers some of the more frequently asked questions about software and usage with Linux.

3.1 How do I sync my computer time clock to 'x'?

The recommended way is to get the xntp package from http://www.eecis.udel.edu/~ntp/ or any of the big Linux archives.

3.2 NTP in 5 minutes or less by Richard Betel (mto@rim.net)

Using NTP is really easy once you have a binary. You need to be able to do four things:

The first step is to choose a time server. Some lucky people have GPS clock receivers or other such time pieces to play with. Setting up NTP servers for those people is beyond the scope of this FAQ.

Everyone else has to get their time from one of the lucky few. Every step you are removed from the original clock, you go up a stratum, and loose a little bit of clock accuracy. At the time of writing, there are only 78 stratum 1 servers on the net, so they can be a little busy sometimes. Thus, most people will connect to a stratum 2 or 3 server. You basically have to maximize the following two goals:

The ideal is to have your ISP run a stratum 1 or 2 server, and you connect to them. Look through the pages at http://www.eecis.udel.edu/~mills/ntp/servers.htm to find an NTP server near you.

Once you've chosen a server, you can configure /etc/ntp.conf. It'll look like this:

server < your-favorite-server >
driftfile /etc/ntp.drift

The first line selects a server. You can put in several to get some fault tolerance and better accuracy. The second line selects a drift file, which is a small file where xntpd puts a number which represents your clock's accuracy. The file is not absolutely necessary, but it is supposed to speed up clock sync-ups a bit when you restart xntpd. xntpd doesn't like to correct clocks which are more than 30 minutes out, so before you start xntpd, run:

        ntpdate -b < your-favorite-server >
ntpdate will query the server just once, and -b makes it set the local system clock. Now just run xntpd. It will put itself into the background, and keep your clock tuned just right. ntpdate and xntpd can both be run in a shell script at boot time so that you don't have to think about it.

If you run many machines, you can set one up to query a remote NTP server, and then have the other machines query the first. For example:

time.rim.net's /etc/ntp.conf:
server clock.isp.net
driftfile /etc/ntp.drift

MTOlinux.rim.net's /etc/ntp.conf:
server time.rim.net
driftfile /etc/ntp.drift
You can check out how your clocks are doing with ntptrace. Its kind of a traceroute for NTP servers. Try running it with no parameters. Don't panic if your clocks don't sync up immediately. I have machines that can take up to 40 minutes to get a good sync to my GPS receiver on time.rim.net. NTP aims for the long haul.

3.3 How do I apply a patch?

cd to the directory with source code. and type "patch < patchfile" (or patch < /path/to/your/pathfile if it resides in different directory).

3.4 Where do I find the latest versions of common packages?

For more sites please see also the Appendix, section A.

3.5 Is it possible to undelete files somehow?

The quick answer would be : NO. There's a quick note in chattr(1) manual page saying that you could use -u flag. But if you would go down you will see:

BUGS AND LIMITATIONS
       As of ext2 fs 0.5a, the `c' and `u' attribute are not hon-
       oured by the kernel code.

Maybe it could be possible to undelete file using a disk editor?

You could give a try:

  1. Remount the filesystem read-only (if the file is on the root filesystem, you need to reboot the system in single-user mode). The longer you leave it, the more likely it is that some of the data will get overwritten.

    If you know the inode number of the file, you can skip next two steps.

  2. Find which blocks contain the data (if you can't figure this out, then you're probably out of luck).
  3. Find out which inode refers to these blocks.
  4. Use debugfs's dump command to save the inode's data to a file.

A newbie solution, submitted by Marshall Lake (mlake@melake.erols.com)

Most Linux shells (such as bash, or csh) have such feature as command aliasing. Using it, you could `emulate' windoze

RECYCLED
feature. To deploy this you should alias "rm $1" to "mv $1 /some_hold_directory", and save this to your login script. (
 /.bash_login
for bash shell). On the same note you can create "undelete" command by aliasing "undelete $1" to "cp /some_hold_directory/$1 $1".

That might be an alternative to editing disk sectors, especially for a novice.


Next Previous Contents