ST Hosting Manual

Our manual

Optimize bash console

Optimize bash console


Dear clients,

white writing on a dark background becomes from time to time more and more difficult to read. (Inverse font)
Especially if you spend several hours configuring in front of your computer.
For this reason we will show you how to optimize the Bash, for more efficiency, and for a little bit more color.

Important instructions for the tutorial:

This tutorial only applies to Linux distributions, which uses the bash shell.
The # implies by default that in most cases, a console-command has to be accomplished with root privileges.
The $ implies by default that this command can be accomplished with standard user-rights.

Colorful console

If you want to add some color to your console, you can do the following adjustments: ~ / .bashrc file:

# ~/.bashrc: executed by bash(1) for non-login shells. # colorforconsole PS1='[\033[1;36m\][\[\033[1;34m\]\u\[\033[1;33m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;36m\]]\[\033[1;31m\]\\$\[\033[0m\] ' # withtime PS1='\[\033[1;73m\][`date +%H:%M:%S`]\'$PS1 # color for the LS command export LS_OPTIONS='--color=auto'

After each ~ / .bashrc change, you should test this command to make sure that the changes work without having to re-login.

$ exec bash -$-

This is how your directory-information should look like:
 

and thats the LS-command, but first you have to make an adjustment according to the second part of the tutorial:
 

If you enter now ls, the contents are displayed in different colors.
This makes it easier for you to distinguish folders, binaries and files.

More efficiency

Furthermore, there are only a few steps necessary to program the console that it knows exactly what should happen when you enter a specific line sequence in the Bash.
We personally use this to automatically get more information without having to specify the parameters.
For instance, just add the following option to the ~ / .bahrc (Additional parameters are entered directly when ls is entered here.):
alias ls='ls $LS_OPTIONS -la'
If you enter ls, the command "ls --color = auto -la" is immediately called.
Of course, there are many other aliases which you can create by your own.
Please note at last that all changes are only valid for the respective user.