Thursday, June 23, 2005

Displaying the path in the title bar

The string '\[\e]2;\H:$PWD\a\]' in PS1 will show the hostname and path in the title bar. The single quotes are important. Also, enclosing the string with \[..\] also matters when it comes to screen wrap. It tells the wrapping mechanism to not count the enclosed characters.

If you use double quotes, use \w instead of $PWD. I like $PWD because it shows the full path and not '~' if the current dir is the home dir.

Another way to do this is in bash is by placing the string in PROMPT_COMMAND. Don't use this unless echo is a shell builtin.

Get the *bleep* out

The PC speaker beeps irritate.

Here's how to turn the beep off for X window:
xset b off

Here's how to turn the beep off for bash:
Edit .inputrc (or /etc/inputrc if you want this systemwide) to reflect:
set bell-style none
Set the bell-style to visual if you want a visual bell instead.

For vim, edit the .vimrc to contain
set visualbell

Running Java apps on FC4 with Sun's JVM

The FC4 release notes advise to not install Sun's JRE rpms, but the self-xtractors instead. If you have these installed, you need to tell certain Java apps to use Sun's VM.

Edit /etc/profile.d/java.sh and type
export J2RE_HOME=/opt/jre1.5.0_03
export PATH=$J2RE_HOME/bin:$PATH

At the prompt, execute . /etc/profile.d/java.sh

Then execute:
alternatives --install /usr/bin/java java /opt/jre1.5.0_03/bin/java 2
alternatives --config java
Output
There are 2 programs which provide 'java'.
Selection Command
---------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
  2 /opt/jre1.5.0_03/bin/java
Enter to keep the current selection[+], or type selection number:
2

/usr/sbin/alternatives --display java


You should see:
java - status is manual.
link currently points to /opt/jre1.5.0_03/bin/java

NVidia on FC4

Again, I got this off the Fedora Core 4 installation notes for us blokes with nVidia cards:

Download the appropriate driver from Nvidia's unix drivers page.

Change to runlevel 3.

Remove the "rhgb quiet" from /etc/grub.conf to disable the "Red Hat Graphical Boot"

Edit /etc/X11/xorg.conf. In the "module" section comment the "load "dri" entry. In the "device" section change "nv" to "nvidia".

Add the line /sbin/modprobe nvidia to /etc/rc.local.

Disable selinux with /usr/sbin/setenforce 0
Execute sh nameOfNvidiaDriverInstaller.run

Reboot.

You should see the nVidia splash screen when Fedora reboots.

To get the graphical boot back:
cp -a /dev/nvidia* /etc/udev/devices
chown root.root /etc/udev/devices/nvidia*

Remove the modprobe nvidia line from /etc/rc.local
Add the "rghb quiet" back to grub.conf

Note that upgrading the kernel requires this whole procedure to be followed again!

Troubleshooting
If the driver installer complains about differing versions of gcc and the version the kernel was compiled with, do this:
sh nameOfNvidiaDriverInstaller.run --extract-only
cd nameOfNvidiaDriverInstaller.run

#I think this should be gcc40
# for FC4- not sure tho'
make install CC=gcc40 # used to be gcc32 for FC1

Speeding up browsing

Haven't verified this - found it on the Fedora Core 4 installation notes over at FedoraNews.org. Edit /etc/modprobe.conf so that it contains

alias net-pf-10 off
alias ipv6 off


Apparently this will speed up browsing and file transfers by decreasing DNS lookup time.

Enabling the slocate Database on FC

To make sure updatedb creates the database used by locate, enable the database creation by setting DAILY_UPDATE to yes in /etc/updatedb.conf.

FC4 system call auditing

Boot the kernel with audit=1 to enable system call auditing. Alternately, enable auditing with the command:

# auditctl -e 1

Firefox bookmark tips

Ok, this isn't exactly Linux, but FF is a linux app so...

In a bookmark's properties, enter a keyword. You can then use the keyword instead of the full URL in the location bar and awayyy we go...

For sites that use GET to submit search forms, note the URL at the time of submitting. Eg: Note the URL:
http://www.google.com/search?q=search+item
Bookmark the URL and edit the bookmark properties. Subsitute a %s in place of the search item. The URL will now be http://www.google.com/search?q=%s.

Assign a keyword - like 'google' to this item. In the location bar type
google searchitem
and we end up straight on the results page.