≡ Menu

Tip of the day

If rpm / yum command hangs during operations or you see error messages - it means your rpm database corrupted. /var/lib/rpm/ stores rpm database just delete the same and rebuild rpm database:

Command to rebuild rpm database

rm -f /var/lib/rpm/__db*
rpm --rebuilddb

Read rpm / yum man pages for more information

Bash / CSH shell offers command history feature. Most of you may be aware and using of UP / DOWN arrow keys to recall previous commands. History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to a previous ommand into the current input line, or fix errors in previous commands quickly.

To repeat last command that started with bar word type i.e. refer to the most recent command starting with string bar):
! bar

For example, let us run lighttpd to test config file:
# /usr/sbin/lighttpd -t -f /jail/usr/local/etc/lighttpd/lighttpd.conf
Output:

Syntax OK

Type few commands:
# pwd
# date

Now to repeat last command that started with lighttpd word type
# !lighttpd
Output:

lighttpd -t -f /jail/usr/local/etc/lighttpd/lighttpd.conf
Syntax OK 

Want to refer to the previous command, just enter
!!

Related shell tip

If you are running Dell PowerEdge 2950 server or HP ProLiant BL480c G1 server and upgraded from old version to latest Red Hat Enterprise Linux ES release 4.5 (Nahant Update 5) you will notice that ordering of your NIC devices changed.

Fix problem before upgrade:

Before running upgrade via up2date command open /etc/sysconfig/network-scripts/ifcfg-eth0 file (for NIC 0) and add line
HWADDR=My-MAC-ADDRESS

Now proceed to upgrade using up2date -u
# up2date -u

Howto fix problem after upgrade:

However chances are very high that after running up2date -u command (i.e. after upgrade) you may notice the problem. Don't panic. Open grub.conf file:
# vi /etc/grub.conf

Find out current kernel line:
kernel /vmlinuz-2.6.9-55.ELsmp ro root=LABEL=/ console=tty0 console=ttyS1,19200n8

Replace as follows:
kernel /vmlinuz-2.6.9-55.ELsmp ro root=LABEL=/ console=tty0 console=ttyS1,19200n8 pci=nobfsort

The pci=nobfsort option restore the original Kernel 2.6 ordering.

A final note

This problem is not Redhat specific. It can occurred on Suse or any other Linux distribution. Please see Linux enumeration of NICs solution published by Dell for more information.

In some situation you may want to avoid loading a Linux driver module automatically . For example:
[a] You would like to use proprietary device driver (I'm against any sort of proprietary drivers) and not inbuilt (reverse engineer) kernel driver.

[b] If your server system connected without a diskette / floppy drive; kernel will try to load floppy driver - disable floppy driver or module.

[c] In some cases buggy driver causes kernel BUG on load so you just want to avoid the problem.

The Linux kernel get module information from /etc/modprobe.conf file and /etc/modprobe.d/* file(s).

If you are using CentOS/Redhat/RHEL/Fedora Linux...

Just open your /etc/modprobe.conf file and turn of auto loading using following syntax:
alias driver-name off

If you are using Debian / Ubuntu Linux...

open /etc/modprobe.d/blacklist file and add drivername using following syntax:
blacklist driver-name

Reboot your box and use lsmod command to show the status of modules in the Linux Kernel.

Let us say your have a long directory name called "A_VERY_ VERY LONG_ DIRECTORY_NAME_TO_ TYPE _ A _ B _C"...

So how do you change to a directory, which is having very long name without typing full name?

Simply use a wildcard character called * as follows
$ cd A_VERY_VERY*

Or type cd A_VERY and hit tab key to complete a directory name :)
$ cd A_VERY_VERY (hit tab key)

Linux turn OFF password expiration / aging

/etc/shadow stores actual password in encrypted format for user’s account with additional properties related to user password.

The password expiration information for a user is contained in the last 6 fields. Password expiration for a select user can be disabled by editing the /etc/shadow file

However I recommend using chage command. The chage command changes the number of days between password changes and the date of the last password change. This information is used by the system to determine when a user must change his/her password.

To list current aging type chage command as follows:
# chage -l vivek
Output:

Last password change                                    : May 22, 2007
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7

To disable password aging / expiration for user foo, type command as follows and set:
Minimum Password Age to 0
Maximum Password Age to 99999
Password Inactive to -1
Account Expiration Date to -1
Interactive mode command:
# chage username
OR
# chage -I -1 -m 0 -M 99999 -E -1 username

Updated for accuracy.

As I said earlier you need to tweak few things to run this monitor with Intel 810 or 845 based chip-set under Ubuntu Linux.

In order to use higher resolution install updated Intel i8xx, i9xx display driver. It is provided by a package called xserver-xorg-video-intel. This package provides the driver for the Intel i8xx and i9xx family of chipsets, including i810, i815, i830, i845, i855, i865, i915, and i945 series chips.

Replace driver by running the apt-get command. Open your terminal and type command:
$ sudo apt-get install xserver-xorg-video-intel

Now run ddcprobe command to get monitor VertRefresh values and HorizSync rate:
$ sudo ddcprobe | grep monitorrange
Output:

monitorrange: 24-82, 50-75

24-82 is your HorizSync rates and the second pair is your VertRefresh (50-75) values.

Next reconfigure xserver (X.org) video and monitor using auto detect feature:
$ sudo dpkg-reconfigure xserver-xorg

Set monitor resolution 1440 x 900 and others as per your requirement. Save the changes and reboot the system.

After login you can adjust screen resolution by visiting System > Preferences > Screen Resolution > Select desired screen resolution such as 1440 x 900 and save the changes.