Affichage des articles dont le libellé est shell. Afficher tous les articles
Affichage des articles dont le libellé est shell. Afficher tous les articles

mardi 15 juillet 2014

Set the colour in terminal of Mac OS X

set the colour for normal users.
1: Go to the home directory, and create the following file:

    vim .bash_profile

2: Insert the following content into the file:

    export TERM="xterm-color"

    PS1='\[\e[00;32m\]\u\[\e[0m\]@\[\e[00;32m\]\w\[\e[0m\]\$'

The definition of each colour can be referred to the previous article.

3: save the file. Make it validated.

    source .bash_profile
-------------------------------------
set the colour for root.
1: login as a root.

    sudo -i

and then, enter the password.

2: create the following file:

    vim .profile

3: Enter the following content into the file (can be the same as normal users):

    export TERM="xterm-color"

    PS1='\[\e[00;31m\]\u\[\e[0m\]@\[\e[00;31m\]\w\[\e[0m\]\$'

4: save the file and make it validated immediately.

    source .profile
-------------------------------------
THEN, THE WORLD BECOMES COLOURFUL! :-)

lundi 7 juillet 2014

Change the Command-Line Prompt Colour in the Ubuntu/Linux Terminal

How to Change the Command-Line Prompt Colour in the Ubuntu/Linux Terminal

The terminal for running commands in Ubuntu and any other Linux distro is dull to look at, but you can easily spice it up a little with some colour.
Simply run the following command in a terminal:
gedit ~/.bashrc
When .bashrc opens, locate and uncommentforce_color_prompt=yes” (that is, remove the hash, so it no longer looks like: #force_color_prompt=yes).
Save the file, and open a new terminal window, and you should already see a change (the prompt should be Light Green, which is defined by 1;32). You can then change any colour value you like; eg: 0;35 = Purple.
To edit the colour values, locate the following section, and change the default values with some of the examples listed further down:
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;31m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
You can check out this Bash colour chart for a full range of colour values, but here are a few basic ones you can play around with (note that “Light” isn’t what you might think – it actually means “bold”):
Black 0;30Dark Gray 1;30Blue 0;34Light Blue 1;34Green 0;32Light Green 1;32Cyan 0;36Light Cyan 1;36Red 0;31Light Red 1;31Purple 0;35Light Purple 1;35Brown 0;33Yellow 1;33Light Gray 0;37White 1;37
For those curious about the codes used in the example pic, here’s the line from that section:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;35m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
As you can see, 1;35 is the Light Purple user and machine name, while the 1;34 is the Light Blue tilde (~). If you want yours a bit brighter, try:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;36m\]\u@\h\[\033[00m\]:\[\033[01;31m\]\w\[\033[00m\]\$ '
… which will give you Light Cyan and Light Red, and look like the following:
In case you’re wondering about the colon and dollar sign, you can change those as well, but you need to do more than just edit the colour values. You’ll need to insert code in the appropriate places, so the line looks like this:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;36m\]\u@\h\[\033[01;33m\]:\[\033[01;31m\]\w\[\033[01;33m\]\$ '
You’ll notice the first highlighted code is just before the colon (:) while the second is before the dollar sign ($). In this example, both are yellow, with the result looking like:
Now, if you want to go even further, you can make the user name stand out by doing the following:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;36m\]\u\[\033[01;35m\]@\h\[\033[01;33m\]:\[\033[01;31m\]\w\[\033[01;33m\]\$ '
That extra bit of code is specifying Light Purple for the @ and the desktop name, making it now look like:
And of course, one last bit of fiddling and you can have every element a different colour. In this last example, we’re going to make the computer name the same as the user name, and have them broken up by red, as with the yellow elements:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;36m\]\u\[\033[01;31m\]@\[\033[01;36m\]\h\[\033[01;33m\]:\[\033[01;31m\]\w\[\033[01;33m\]\$ '
As you can see, the @ is now Light Red, while the code before \h is specifying Light Cyan, like the user name:
You’ll also notice when you type commands that the colour of the text will match that of the $, which can be preferable if using a “light” colour, since the bold text is easier to see.
Lastly, in case you’re wondering whether the prompt can end in anything other than a $, the answer is yes, and it’s as easy as opening the Character Map (sudo apt-get install gucharmap if you don’t have it), selecting a character, and pasting it over the $ at the end of the line of code:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;36m\]\u\[\033[01;31m\]@\[\033[01;36m\]\h\[\033[01;33m\]:\[\033[01;31m\]\w\[\033[01;33m\] '
In that example, I simply selected a cool looking character from the font Runic, and replaced the $ with that. You’ll also note one other thing you’ll have to do, and that’s remove the \ before it, or else that will appear too (obviously, that doesn’t happen if using the $, but will with other characters).
Have fun experimenting!

Original Link: http://ubuntugenius.wordpress.com/2011/07/11/how-to-change-the-command-line-prompt-colour-in-the-ubuntulinux-terminal/

and

http://www.arwin.net/tech/bash.php

lundi 14 mars 2011

how to force clear the trash can in Mac OS

open your temial and enter the trash can directory:

cd ~/.Trash/

Then, you can review all items by using ls command.

To delete all the files and folders, using the following command:

sudo rm -rf *