The standard BASH colour configuration uses a blue colour for listing directories (ls) which is difficult to read on a black background. While this is the “standard colour”, due to the impracticality I have decided to change it.

The personal BASH user configuration file is: ~/.bashrc. Simply add the following line to this file: LS_COLORS='di=1;32' ; export LS_COLORS The code 1;32; is for a light green colour.

The .bashrc file also has a number of other interesting “features” and options, such as aliases and colour prompts. If you turn on the colour prompt option (force_color_prompt=yes), again the dark blue colour may be difficult to read so I change the prompt color code from 34 to 36.

To update the terminal, without logging off type: ~/.bashrc or source ~/.bashrc. The command exec bash will also work.

Add the following commands to vim ~/.bashrc, the aliases can also be added to the separate file .bash_aliases, vim ~/.bash_aliases:

  • alias ll='ls -la --color=auto'
  • alias lh='ls -laL --color=auto'
  • key ls options :
    • -a, --all : do not ignore entries starting with . (do not ignore hidden files)
    • -l : use a long listing format
    • -L, --dereference : when showing file information for a symbolic link, show information for the file the link references rather than for the link itself
    • -h : use binary abbreviation (e.g. 1k 10G 2T, etc.)
    • -i : show index number of each file
    • -R : list sub-directories recursively
    • -S : sort by file size, largest first
    • -t : sort by time

To allow the BASH history to be updated from each terminal after each command, instead of last closed bash terminal overwriting others upon closure add:

   export HISTTIMEFORMAT="%d/%m/%y %T "
   export HISTCONTROL=ignoredups:erasedups  # no duplicate entries
   export HISTSIZE=100000                   # big big history
   export HISTFILESIZE=100000               # big big history
   shopt -s histappend
   PROMPT_COMMAND="history -w"
   export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

To reload bash: exec bash

The following command gives an example of time format control on ls command. ls -l --time-style="+%Y-%m-%d %H:%M:%S"

  • history | grep command → to see list of history with text “command”
  • history !x → to repeat the history command at line x
  • history -d x → to delete history line x


sudo remembers your password for 15 minutes by default. After 15 minutes, you will be asked to enter the password again for any sudo command.
This is actually a security feature. For instance, if you left the terminal open after running commands with sudo, the authentication automatically expires after 15 minutes of sudo inactivity. So, the other users can’t do any further administrative tasks.

This behaviour can be changed by increasing or decreasing the sudo password timeout limit as described below.
sudo visudo
Find Defaults env_reset and change to Defaults env_reset, timestamp_timeout=30
This will change the default 15 minutes time out to 30 minutes. Changing the timestamp_timeout=0 will require the sudo password at every use. Specifying a negative value and the timeout will never expire.

sudo -k resets the sudo timeout and password must be entered again next time sudo is used.

The default timeout seems pretty reasonable to me so I can not be bothered changing it!

Change Sudo Password Timeout in Linux

Strangely XFCE does not seem have and any kind of screen brightness control built in. There also seems to be no optional extra for this either.
Bash: A Simple Script for Changing Display Brightness with XRANDR

  • xrandr --listactivemonitors to list current active monitors
  • xrandr --output HDMI-1 --brightness 0.5 && xrandr --output DP-2 --brightness 0.5
  • xrandr --output [displayID] --gamma 1.0:0.95:0.85 to give a night mode effect
  • xrandr --output HDMI-1 --gamma 1.0:0.9:0.85 --brightness 0.7to give a combined night and dimming effect.
  • /mnt/shared/www/dokuwiki/data/pages/home_server/home_server_setup/other_services/bash.txt
  • Last modified: 2022-09-26 Mon wk39 05:25
  • by baumkp