define( 'WPCACHEHOME', '/srv/www/www.ichilton.co.uk/html/blog/wp-content/plugins/wp-super-cache/' ); //Added by WP-Cache Manager Linux | Ian Chilton

Archive

Archive for the ‘Linux’ Category

Fixing the Ubuntu “Unable to locate tools.jar” Error

June 14th, 2011 No comments

When trying to use ant on Ubuntu (in either 10.04 or 10.10), I get the following error:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar

Turns out the fix is quite simple:

Edit /etc/apt/sources.list, find the lines similar to the following and uncomment them (obviously 10.04 will have lucid instead of maverick):
deb http://archive.canonical.com/ubuntu maverick partner
deb-src http://archive.canonical.com/ubuntu maverick partner

sudo apt-get update && apt-get install sun-java6-jdk
sudo update-alternatives --config java

Pick the option for: /usr/lib/jvm/java-6-sun/jre/bin/java which was number 2 on mine, rather than the openjdk default.

You now shouldn’t get that warning/error.

Categories: Linux Tags: ,

Recursively chmod Files and Directories

June 3rd, 2010 No comments

To recursively chmod all files in the current directory (and sub-directories), you can do this:

find . -type d -exec chmod 755 {} \;

To do the same with just files, you can use:

find . -type f -exec chmod 644 {} \;
Categories: Linux Tags: , ,

Changing Prompt and xterm Title in Bash

May 12th, 2010 No comments

It’s really useful to not only be able to see the user and directory in your prompt but to have different colours for different users/servers – like a different colour for root or production boxes. Here is the code I use – just put it in a .profile in the users’s home directory (or in /etc/profile for globally):

# Set xterm title:
SHOSTNAME=`hostname -s`
PROMPT_COMMAND='if [ "${TERM}" = "xterm" -o "${TERM}" = "xterm-color" ];
then
   if [ -n "${XTITLE}" ];
   then
      echo -ne "\033]0;${XTITLE}\007";
   else
      echo -ne "\033]0;[${USER}@${SHOSTNAME}:${PWD}]\007" | sed -e "s@${HOME}@\~@";
   fi;
fi'    

# Set Bash Prompt:
if [ "$BASH" ]; then
  PS1='\[\033[1;36m\][\u@\h:\w]\$\[\033[0m\] '
#  alias ls='ls --color'
else
  if [ "`id -u`" -eq 0 ]; then
    PS1='# '
  else
    PS1='$ '
  fi
fi  

export PS1 PROMPT_COMMAND SHOSTNAME

You can change the colours using the following codes:

# Black       0;30     Dark Gray     1;30
# Blue        0;34     Light Blue    1;34
# Green       0;32     Light Green   1;32
# Cyan        0;36     Light Cyan    1;36
# Red         0;31     Light Red     1;31
# Purple      0;35     Light Purple  1;35
# Brown       0;33     Yellow        1;33
# Light Gray  0;37     White         1;37
Categories: Linux Tags: , , ,