So I’ve been getting acclimated to my new environment at work and have been thinking more and more about how much I miss Linux and the command line. The new environment is nearly entirely a Windows based environment and I feel like my productivity has dropped without the option for using the command line, hence the title of this article. It seems like the most productive aspect of my Windows experience is using a web browser.
At my previous place of employment I got so used to command line that I take it for granted now as I could do nearly all of my daily work from the command line (aside from web browsing, and email I never made that jump). In this post I would like to highlight some of the command line tools that I am talking about and how they contributed to my productivity in a former life (although I still take advantage of them at home obviously).
The first and most important piece of the command line experience is getting a good terminal multiplexer, I have played with both screen and tmux but have to say out of the two I like using tmux more. Both of them can do nearly identical things but I just became more attached to tmux the more that I played with it, one thing that drew me in was the quick and easy screen splitting functionality of tmux.
After much experimentation I finally have a .tmux.conf config file that I feel comfortable with that utilizes all of the settings I like and need as well as the bindings to match those in screen along with a few other neat tricks.
# This configuration file binds many of the common GNU screen key bindings to # appropriate tmux key bindings. Note that for some key bindings there is no # tmux analogue and also that this set omits binding some commands available in # tmux but not in screen.# # Note this is a good starting point but you should check out the man page for more # configuration options if you really want to get more out of tmux ### Unbind existing tmux key bindings (except 0-9). # Set the prefix to ^A. unbind C-b set -g prefix ^A bind a send-prefix # Bind appropriate commands similar to screen. # lockscreen ^X x unbind ^X bind ^X lock-server unbind x bind x lock-server # screen ^C c unbind ^Cbind ^C new-window bind cbind c new-window # detach ^D d unbind ^D bind ^D detach # displays * unbind * bind * list-clients # next ^@ ^N sp n unbind ^@ bind ^@ next-window unbind ^N bind ^N next-window unbind " " bind " " next-window unbind n bind n next-window # other ^A unbind ^A bind ^A last-window # prev ^H ^P p ^? unbind ^H bind ^H previous-window unbind ^P bind ^P previous-window unbind p bind p previous-window unbind BSpace bind BSpace previous-window # windows ^W w unbind ^W bind ^W list-windows unbind w bind w list-windows # quit \ unbind \ bind \ confirm-before "kill-server" # kill K k unbind K bind K confirm-before "kill-window" unbind k bind k confirm-before "kill-window" # redisplay ^L l unbind ^L bind ^L refresh-client unbind l bind l refresh-client # More straight forward key bindings for splitting unbind % bind | split-window -h bind v split-window -h unbind '"' bind - split-window -v bind h split-window -v # History set -g history-limit 10000 # Terminal emulator window title set -g set-titles on set -g set-titles-string '#S:#I.#P #W' # Status Bar set -g status-bg black set -g status-fg white set -g status-interval 1 #set -g status-left '#[fg=green]#H#[default]' set -g status-left '#[fg=green](#S) #(whoami)@#(host `hostname` | cut -d " " -f 4)' set -g status-right '#[fg=yellow]#(cut -d " " -f 1-4 /proc/loadavg)#[default] #[fg=cyan,bold]%Y-%m-%d %H:%M:%S#[default]' # Notifying if other windows has activities setw -g monitor-activity on set -g visual-activity on # Highlighting the active window in status bar setw -g window-status-current-bg red # Clock setw -g clock-mode-colour green setw -g clock-mode-style 24 # Hostname and IP address #set -g status-right '#[fg=white]#(hostname)@#(host `hostname` | cut -d " " -f 4)' #set -g status-right '#[fg=white]#(host `hostname` | cut -d " " -f 4)'
The most important part of how you utilize your tmux experience is the management of your sessions. Within tmux I usually have at least four terminals open for various different tasks. At least one term for bash, one for Irssi command line IRC client, one for ipython python interpreter and one for editing text files (I use Vim but that is separate topic). Once you get comfortable with the key combinations for navigation and other tasks, tmux can increase your productivity a great deal. As I stated, in my daily work the only things I don’t use the command line for are email and web browsing, which I know is possible I just never tired to make the switch. I would still like to do at some point in the future.
If you have any command line-fu you would like to share let me know or post in the comments section I always love hearing about what others are doing and incorporating it into my own bag of tricks.