Colorful Bash and Vim in CentOS 7

CentOS comes default with a bland bash and vi setup. I prefer to have a colorful interface as I work. Here’s how I got mine working…

Bash

Most people use a colorful bash to distinguish between files and directories and such.

Open a terminal and do the following:

  • change to the root user

su -
or
sudo -i

  • run the following two commands:

echo "alias ls='ls --color=auto'" >> ~/.bashrc
source ~/.bashrc

Vim

Syntax highlighting is useful if you use Vim to edit files and create scripts and such. It ensures that you are doing it right. As per Vim’s website:

Syntax highlighting enables Vim to show parts of the text in another font or color. Those parts can be specific keywords or text matching a pattern.

Open a terminal and do the following:

  • change to the root user

su -

or

sudo -i

  • Make sure vim is installed

yum -y install vim-enhanced

  • Open the profile config file for editing

vi /etc/profile

  • Add the following line

alias vi=vim

  • Run the following to finalize the changes

source /etc/profile

That’s it… Now go have fun with your colorful ls outputs and syntax highlighted edits.

Advertisements

Share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s