Esta de moda escuchar de metodologías ágiles y muchas empresas quieren comenzar a usarlas pero… ¿Qué debes saber antes de sumergirte en ese mundo?
The out-of-the-box configuration of the Terminal application in Mac OS X is quite simple/plain. If you don’t use it frequently, it will be ok to leave it in that way. However, if you continuously open Terminal, it will be great to customize it so you can be more productive.
By default, this is how Terminal application looks like (Basic Profile):
As you can see, it is based just in black text and white background but you can give more life to Terminal using colors and this article will explain how to customize it according to your own tastes.
Mac OS X Terminal
First, let’s change the default profile to other one . To do so, open a new Terminal and go to Terminal -> Preferences -> Profiles. In my case, I like the Pro Profile (cool name!) because it looks like an old terminal with white text and black background.
Besides changing the profile, you should consider enabling the following options in Text Tab:
- Antialiases text: To apply text smoothing. It is specially useful with some kind of monitors but you can leave it enabled any way.
- Use bold fonts: To use bold for emphasis. Must be enabled.
- Allow blinking text: To allow text to flash on and off. Highly recommended.
- Display ANSI colors: To display text using the colors embedded in some terminal emulator standards. Must be enabled.
- Use bright colors for bold text: To add emphasis to bold text with color. Must be enabled.
Now it is time to configure the BASH prompt; that means, change the environment variable $PS1. Let’s check its default value:
optimus:~ modlost$ echo $PS1 \h:\W \u\$
The prompt shows the hostname (\h), colon (:), current directory base name (\W), username (\u) and # or $ symbol ($). You can find more information about all the backslash-escape especial characters available for this variable in the unix man page for BASH section PROMPTING. In this case, we are going to use these options:
- \u : The username of the current user.
- \h : The hostname up to the first ‘.’.
- \w: The current working directory, with $HOME abbreviated with a tilde.
- \$: If the effective UID is 0, a #, otherwise a $
In my experience a simple (short) prompt works best and Debian distribution defines one by default that I really like. Take a look at it executing the following command:
optimus:~ modlost$ PS1='\u@\h:\w\$ ' modlost@optimus:~$
Looks great but it will be better with colors. To help you decide which color you would like, you can use this shell script to print the 16 ANSI color codes. Execute it in a Terminal using your prefered profile so you can decide which colors are best for you.
Now you can choose where you want to change colors coping those codes in $PS1. Debian distribution define a nice colors, let’s use the same:
modlost@optimus:~$ PS1=‘\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[m\]\$ ‘
To make these changes permanent you should define $PS1 in .bash_profile because Terminal starts login shells. At the end of the next section you will find a complete ~/.bash_profile.
Configuring ls and grep commands
If you use the Terminal a lot, it is probably that ls is one of your most used commands so adding color will be awesome. To do that, you will have to define a new enviroment variable LSCOLORS containing a string that has the following structure:
- symbolic link
- block special
- character special
- executable with setuid bit set
- executable with setgid bit set
- directory writable to others, with sticky bit
- directory writable to others, without sticky bit
Each one of those items contains two characters, one for the foreground and the other for the background. The color codes you can use are:
- a black
- b red
- c green
- d brown
- e blue
- f magenta
- g cyan
- h light grey
- A bold black, usually shows up as dark grey
- B bold red
- C bold green
- D bold brown, usually shows up as yellow
- E bold blue
- F bold magenta
- G bold cyan
- H bold light grey; looks like bright white
- x default foreground or background
For Pro Profile that uses dark background, this could be one good color combination:
But it doesn’t work unless you add the -G option in every ls execution, so the best way to do that is defining aliases:
modlost@optimus:~$ alias ls='ls -G' modlost@optimus:~$ alias ll='ls -l' modlost@optimus:~$ alias la='ls -A' modlost@optimus:~$ alias l='ls -CF'
modlost@optimus:~$ alias grep='grep --colour=auto' modlost@optimus:~$ alias fgrep='fgrep --colour=auto' modlost@optimus:~$ alias egrep='egrep --colour=auto'
Execute a little example and you will see how useful is enabling colors in grep:
So the final ~/.bash_profile is the following:
# PROMPT CONFIG export PS1="\[\e]0;\a\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[m\]\$ " # COLOR COMMANDS export LSCOLORS=ExFxBxDxCxegedabagacad alias ls='ls -G' alias grep='grep --colour=auto' alias fgrep='fgrep --colour=auto' alias egrep='egrep --colour=auto' # ALIASES alias ll='ls -l' alias la='ls -A' alias l='ls -CF'
Finally, if you use Vi Editor a lot, you should create a ~/.vimrc file with the following content:
syntax on set background=dark
Now your Mac OS X Terminal Application has a lot of colors and that will help you every day and make you more productive.
I was doing some guitar exercises when a picture came to my mind… at that moment, I just said: “Purple Beauty” and this melody started to flow!!! I was greatly surprised so I decided to publish it.
This recording was made with my BOSS RC-300 and POD HD500… A great combination!
Raining Again by Abner Ballardo is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
A few months ago, I was discussing about social media in business with some friends, when someone asked me: “Why you don’t have a Facebook or Google+ page for your blog?”. My honest answer was: “Because of my laziness”. I know that creating a page is too simple but the real challenge is to maintain it with content, so I was thinking about it for a few weeks before I created them, just as proof of concept.
And at the end of the last year, the proof of concept ended with a plan: I can maintain it with content that I find in the web and don’t require a blog post or article, I’m an avid reader so I always have something to share. So I invited you to join my Facebook & Google+ pages; you will find Software Development, Music and Photography content.
Module Lost Google+ Page
Module Lost Facebook page
A new year has come and, for sure, you have a lot dreams or ideas around your head. Maybe you have them for years without doing anything to make them real, but the 2013 could be different. Watch these videos and let your heart beat and begin this year motivated to do something.
Steve Jobs – Stanford
Neil Gaiman – University of Arts
Randy Pausch – Achieving your childhood dreams
In this short talk, Renny Gleeson presents a different way to use the classic HTML 404 Error Page. He proposed to have friendlier messages in the web and also use them to capture users/clients interest. It is something to consider in the next web projects, isn’t it?.
Finally, he left this quote that could be useful when you are defining an HTML 404 Error Page.
A simple mistake can tell me what you aren’t. Or remind me why I love you