UNIX/Linux

Using what to display version details

March 15th, 2005

Programs and scripts often containg code to allow you to run the program with a flag such as -v or --version to return the version number.

An easy way to allow version details to be displayed is to use the UNIX what command.

Users then use the command what yourprogram to see the version details.

To implement this, add a line in your program containing the text string @(#) followed by whatever version details you want to give, followed by a double-quote mark or a line break.
Read the rest of this entry »

Leave a comment

 

Configuring vi

March 15th, 2005

The configuration file for vi is called .exrc and it lives in your home directory.

To change your default vi settings, edit ~/.exrc. For example, add:

set showmode
set number

This displays the current mode (e.g. "INSERT MODE") and displays line numbers.

To temporarily remove the line numbers (e.g. so that you can copy lines without copying the numbers) use the following command in vi:

:set nonu

Potentially similar posts

Leave a comment



Using yum to download and maintain RPM packages

February 25th, 2005

If you're using Fedora and you're not using yum, you ought to start using it - I just have! It makes the process of installing Linux software so much easier. Whereas when you install packages using the rpm command you often get "failed dependencies" messages, with yum it just goes off and installs the dependent packages for you as well.

The only fly in the ointment is a little tiny gnat that you can soon get rid of. The first time you try to use yum you will probably get a message like:

You have enabled checking of packages via GPG keys. This is a good thing.
However, you do not have any GPG public keys installed. You need to download
the keys for packages you wish to install and install them.
You can do that by running the command:
    rpm --import public.gpg.key
For more information contact your distribution or package provider.

This means you need to tell yum who it can trust. You do this by installing Fedora security keys:

rpm --import /usr/share/rhn/RPM-GPG-KEY*

Note
You have to do all this as root.

For more information, see:
www.hut.fi/~tkarvine/yum-package-manager.html
Read the rest of this entry »

Leave a comment



Checking whether you have an RPM installed

February 25th, 2005

Q: What do you do when you want to check that you have a particular Linux RPM installed, but you can't remember exactly what it was called?

A: Run an RPM query to return the details of all the installed RPMs, and use grep to filter the results.

For example, I just wanted to check which DocBook RPMs, if any, were installed on my machine. The command:

rpm -qa|grep -i docbook

Yielded the reply:

docbook-slides-3.3.1-2
docbook-dtds-1.0-25
docbook-simple-1.0-2
docbook-style-xsl-1.65.1-2
docbook-utils-0.6.14-4
docbook-utils-pdf-0.6.14-4
docbook-style-dsssl-1.78-4

Leave a comment



Checking/resetting the date/time

February 22nd, 2005

To check whether the date/time is correct on your Linux machine, enter the command:

date

And compare the results with the output of the command:

rdate -p <server>

where server is one of the following:

table.bespoke {
border: 1px hidden #342DAC;
border-collapse: collapse;
background-color: #F3FEFF;
}
table.bespoke th {
border: 1px outset #342DAC;
background-color: #FFFFF0;
}
table.bespoke td {
border: 1px outset #342DAC;
padding: 2px;
}
table.bespoke .country {
text-align: center;
}

Server Country
ntp.demon.co.uk UK
nist1.datum.com US
time-b.nist.gov US
time.nist.gov US
utcnist.colorado.edu US
mizbeaver.udel.edu US

For example:

# date
Tue Feb 22 08:55:06 GMT 2005
# rdate -p ntp.demon.co.uk
rdate: [ntp.demon.co.uk]        Tue Feb 22 08:50:14 2005

In the above example, the local machine is about 5 minutes fast.

rdate -p <server>

prints the date from the remote server.

To set your Linux machine to that date, use:

rdate -s <server>

For example:

rdate -s ntp.demon.co.uk

You can use ntpd to check and set your time on a regular basis, but if keeping accurate time isn't critical for you, the occasional manual check and reset is all you need.

For more information, see: http://linuxreviews.org/howtos/ntp/

Leave a comment



^ back to top ^

Page 5 of 9« FirstNewer34567OlderLast »