Category Archives: unix-linux

How to set terminal title dynamically to the current working directory?

It is sometimes helpful to set a terminal window title from a script, so that you can put a couple of reminders of how to do things there. The Xfce4-terminal preference tells me it can be done by setting the “Dynamically-set title” position, but never says how to dynamically put text in the title bar.

Using Zsh

As I’m gradually switching to Zsh, this short post explains how to dynamically set pwd, or current working directory, to xfce terminal in Zsh. Actually, it only contains two steps:

  1. open ~/.zshrc
  2. add the following code
case $TERM in
    precmd () {print -Pn "\e]0;%~\a"}

Let me explain this piece of monstrosity a little bit.

Undefined reference to Sqrt — A quick note to compile SVM-multiclass

When I compiled SVM-multiclass using make, I got an error msg saying “undefined reference to sqrt“. I check the makefile and found that -lm is included in the gcc flags.

The trick here is to put the library AFTER the module you are compiling. The problem is a reference thing. The linker resolves references in order, so when the library is BEFORE the module being compiled, the linker gets confused and does not think that any of the functions in the library are needed. By putting the library AFTER the module, the references to the library in the module are resolved by the linker. read more

Change gedit embedded terminal colors

For Ubuntu only:

  1. install dconf-tools and gconf-editor
  2. in gconf-editor, navigate to apps → gnome-terminal → profiles → Default
  3. in dconf-tools, navigate to org → gnome → gedit → plugins → terminal
  4. uncheck “use-theme-colors”
  5. copy values of “background-color“, “foreground-color“, and “palette“, from gconf-editor to dconf-tools

Install Gnuplot 4.6 with PDF on Ubuntu

It is always hard to install gnuplot manually on Ubuntu, especially if you want to plot diagram in PDF, JPEG, or PNG formats. This short 101 article describes one way to install gnuplot with PDF on Ubuntu.

  1. download pdflib-light and extract to $PDFLIB
  2. compile and install pdflib-light

    cd $PDFLIB
    sudo make install
  3. refresh lib cache: sudo ldconfig

  4. download gunplot and extract to $GNUPLOT

  5. compile and install gnuplot

    cd $GNUPLOT  
    ./configure --with-pdf  
    sudo make install  

Note: other packages which can be installed via apt-get read more