Created
December 24, 2014 06:49
-
-
Save anonymous/402e1c2abd2829dc0c44 to your computer and use it in GitHub Desktop.
terminal colors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Enable Colorful Terminal in Debian and Ubuntu | |
| ``` | |
| vim .bashrc | |
| ``` | |
| Enabling 256 color mode in Ubuntu’s Bash terminal | |
| When I first connected to my headless Ubuntu server and started opening files in Vim, I couldn’t figure out why it was ignoring my Vim color schemes. Everything was displaying in garish blues, reds and yellows. | |
| It took little digging around to figure out that 256 color mode isn’t enabled by default in some versions of Ubuntu, including the server version of Ubuntu 11.10 that I was using. This is how I got my color schemes working. | |
| To determine what mode you’re currently running in, use the following command: | |
| `tput colors` | |
| At first, I got the following output: | |
| `tput colors` | |
| 8 | |
| The output indicates how many colors the terminal is set up to use, which was 8 in my case. The first step to enabling 256 colors is installing the ncurses-term package, which provides addtional features for the terminal: | |
| ` sudo apt-get install ncurses-term` | |
| Then edit .bashrc, the configuration file for the Bash terminal, using the text editor of your choice. Here I’m using Vim: | |
| ` vim ~/.bashrc` | |
| Add the following line to the .bashrc file (I put it near the bottom): | |
| `export TERM=xterm-256color` | |
| Save the changes, then force Bash to reload the configuration file: | |
| ` source ~/.bashrc` | |
| Now rerun the tput command, and the system should tell you that 256 colors are avaiable: | |
| ` tput colors` | |
| 256 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment