Useful linux environment setup info
I've just finished installing Crunchbang [crunchbang_abandoned] on my computer and just like every time I install a new Linux distribution I find I have to expend some effort in setting it up to my liking. Given that I'm using more lightweight distributions now more things aren't installed by default so to track everything down is a bit more of a chore. Inevitably I forget something each time I reinstall so I'm keeping a list here of some of the things I like to make sure I have installed. (I'll keep editing things in as I find them). If there's anything particularly awesome that is missing from here get in contact and let me know.
categories index:
Command line
Completion
If it's not installed get bash-completion. This often comes pre-installed but on my recent install of a Arch Linux server at work I noticed this was missing. I had no idea how much I used this until I didn't have it.
Command prompt - PS1
I like to have the current git branch pop up in the command line prompt whenever I'm working on a project with a git repository. To add git information to the command line involves changing the bash command prompt variable PS1. In .bashrc file I add the following line to change the PS1 variable:
in ~/.bashrc:
#git branch names in prompt! PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\]:\w\[\033[01;33m\]$(__git_ps1)\[\033[01;34m\]\$\[\033[00m\] '
Default editor
Whenever I have to type a really long command I like the ctl-x-e command from the terminal. When you do this it pops up your default editor as defined by the environment variable EDITOR to edit the command in. Often the default is Nano, but I personally prefer vim as my default editor so I set that default as follows:
In ~/.bashrc:
export EDITOR=vim
Alias for ls -la
I find I type ls -la a fair bit so I make an alias la that runs ls -la.
In ~/.bashrc:
alias "la=ls -la"
Keyboard
Because I do a lot of programming I do a lot of typing so I like my keyboard setup to be as efficient and ergonomic as possible. If I'm ever doing a substantial amount of work on a laptop I find swapping left control and caps to be absolutely necessary. With correct technique this might not be the best on some keyboards but a lot of laptop keyboards don't allow you to hit ctrl with the palm and I find this to be a massive pain in the ass.
Swapping those keys can be done the following way: Create a keymappings file, I called mine swap_leftctl_caps.kmap.
! ! Swap Caps_Lock and Control_L ! remove Lock = Caps_Lock remove Control = Control_L keysym Control_L = Caps_Lock keysym Caps_Lock = Control_L add Lock = Caps_Lock add Control = Control_L
This can then be used with the following command:
xmodmap swap_leftctl_caps.kmap
Git
Enable color in your git output. This makes the output from git commands like git diff much easier to read:
git config --global color.ui auto
Note that in git version >1.8 this option is on by default.
vim
There's a ton of different ways in which to set up and use vim for maximum productivity. If you do a lot of development work then having your text editor set up to your liking is a huge productivity booster.
At the minimum I add the following to my .vimrc file:
"syntax highlighting syntax on "4 character wide tabs set tabstop=4 set shiftwidth=4 "search highlighting set hlsearch "python settings autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab "ignore binary files set wildignore=*.o,*.obj,*.bak,*.elf,*.exe,*.py[co]
Then the next step is to get a Vim plugin manager. Getting the Pathogen Vim plugin manager is a definite win. Plugins can be installed into ~/.vim/bundle/<new plugin>
You can get plugins from Git repositories really easily by doing:
cd ~/.vim/bundle
git clone git://path/to/plugin/repo
I personally like to get Fugitive and trailing whitespace at a minimum:
A list of great plugins can be found here: https://www.bestofvim.com/plugin/
Password manager
For quite some time now there has been far too many different passwords for me to effectively remember. Using a password manager has made life quite a bit easier.
I used to use Keepass on Windows but because I had to use Linux I needed a cross platform password manager so I moved to KeepassX (The X in KeepassX refers to the cross platform nature of that project). KeepassX hasn't been maintained in a while so I now use the KeepassXC fork which is currently maintained (as of 2017).
To install KeepassXC:
sudo snap install keepassxc
This will use snap to install the package. See their downloads page for other options: https://keepassxc.org/download
(If for some reason you want the older KeepassX with Ubuntu there's a PPA for KeepassX installs: https://launchpad.net/~keepassx/+archive/daily)
Screen
Ever since I used a color temperature manager for my monitor I have found late night computer usage doesn't interfere with my sleep as much. So installing one has been a high priority on every setup. Recently I have been using Redshift because it's open source and does just what I want. Managing the screen color temperature isn't limited to just my desktop computer. Currently I'm using twilight on my phone.
sudo apt-get install redshift
Unfortunately there's some annoying issues with geoclue that seems to frequently cause it to not work. So therefore I don't use that at all and I just set the location provider to manual in the configuration file. In ~/.config/redshift.conf:
; Global settings for redshift [redshift] location-provider=manual ;location configuration [manual] lat=12.34 lon=-56.78
System tools
Many system tools are extremely useful and you only really know how much you use them when you don't have access to them.
htop is incredibly handy, if it isn't installed I make sure to get it:
sudo apt-get install htop
[crunchbang_abandoned] | I actually gave up on Crunchbang in 2015 around the time when Philip Newborough who was the distro maintainer recommended people use regular Debian. As of 2019 there's an actively developed community continuation of the project called BunsenLabs but I'm yet to try this. |