Skip to content

Shell tweaks:


setup colored less output

  • install following packages

  • on ubuntu:

    1
    sudo apt install libsource-highlight-common source-highlight
    
  • on fedora:

    1
    sudo dnf install source-highlight
    
  • getting the scripts path:

  • ubuntu:

    1
    export HIGHLIGHTER=`dpkg -L libsource-highlight-common | grep lesspipe`
    
  • fedora:

    1
    export HIGHLIGHTER=`rpm -ql source-highlight | grep lesspipe`
    
  • adding env vars to your favorite shell:

1
2
3
4
5
6
# get used shell and it's config file
USED_SHELL=`echo $SHELL | rev | cut -d'/' -f1 | rev`
SHELL_CONF=".${USED_SHELL}rc"
# append exports to config file
echo export LESSOPEN='"| '$HIGHLIGHTER '%s"' >> $HOME/$SHELL_CONF
echo export LESS='" -R "' >> $HOME/$SHELL_CONF