Linux Power user; enhanced your productivity
Kapil Sharma
Vice President (Tech) at RideAlly, 19+ years' experience in Web-App Development, Providing Technical Solutions to Business Problems Technical blogger & speaker.
Introduction
You must have heard about power user or some users/coders doing things very quickly and efficiently compared to average users/coders. It is not a magic but just some practice, setup and advanced knowledge/configuration of tools you use. If you never heard about power user, read the following Wikipedia article.
In this article, we will see how we can set up our tools (operating system, command line, and software including IDE/Editors) to become more productive. This is going to be a long article.
Tools in this article are specifically tested on Ubuntu 18.04 but most of them must work on any operating system.
Table of contents
- Background story
- Disclaimer
- Is it worth investing time?
- Blind typing/typing speed
- Limiting the use of mouse
- Basic Operating system setup
- Quickly switching programs
- Max screen
- Virtual desktop
- Fonts (are important, we see them for hours)
- Terminal / Shell
- Ahh not terminal, its Terminator (basic) vs Guake (intermediate)
- Vim basics
- Idea IDE (PHP Storm)
- VS Code and Markdown
- Little advanced terminal
- OhMyZsh
- Guake + Tmux = Awesome
- Guake
- Tmux
- Guake + Tmux + Vim = Killer combo
- Vim intermediate: Make it look better, Dracula, NERDTree
Background story
I joined cactus on February 17th, 2020. I was using macOS for 5+ years before joining cactus, my mind and fingers (I hate mouse, it's slow) were perfectly trained to use Mac for doing a lot of time taking activities very quickly. This include lot of customization on the Mac I previously owned (both office and personal laptop). However, the hardware I got at Cactus is very good, one of the best Dell laptops for programming. In terms of cost, it is more costly than Macbook air (My preferred laptop) so I should have no reason to complain (Except weight of laptop it feels thrice heavy than my MacBook Air).
Even though both Linux and Mac are Unix based, they are completely different; right from the kernel, desktop environment, shortcuts and pretty much everything. When I got Ubuntu, I was little worried if I'll be as productive as I was with Mac but I took it as a challenge (Not having a preferred tool is not an excuse for being unproductive). In the last six weeks, I did a lot of customization on my laptop (Ubuntu-based) so that I can achieve some of my Mac productivity levels. Now other Ubuntu user might feel it a different Operating System and might not even operate my laptop for development (That's good, right, my laptop is mine).
Although I'm still not perfectly satisfied and continuously improving my setup to be more productive, I feel I achieved a satisfactory configuration (for me). I'm sharing it here just in case it might help other developers.
Disclaimer
Please note, everyone has a different preference. Below setup works good for me but it might not be a preferred setup for many. Also, I'm using Linux as base OS after a long time, please excuse me if I didn't include your favourite tool/trick. However, please feel free to let me know how to make this setup even better.
Some of the configurations might be little too complex and might not fit for everyone, do not apply them on your Ubuntu/Editor/IDE without completely understanding them (and knowing how to revert), or you may make them unusable.
Also, I started using such setup (regardless of the operating system) many years ago, do not expect everything will apply to you just in a couple of days/months.
Is it worth investing time?
Well, this question might have a different answer for different people. Just decide the best answer for you:
No, it isn't
- Productivity means completing my assigned tasks on time and I'm completing my tasks on time.
Even though some might not agree (like me), this is one of the valid definitions of productivity. If you fall into this category, you have a perfect setup, please stop reading now.
On the side note, if you are not completing your tasks on time, I apologise but you need more learning, time management and discipline than investing time on following steps. However, you decide if you want to read further.
Yes, it is
- Even though I meet the above definition, no one is perfect and there is always a scope of improvement.
If you fall into this category, I would recommend reading remaining of the article. Everything might not suit you but you can take advantage of a few of the things mentioned below.
Blind typing/typing speed
I'm a developer. Even though developers invest more time in reading code and thinking and less time in typing, they do type a lot.
If you are in a profession, where you need to type a lot, you need to type with 8 fingers (10 including thumb for shortcuts and space)
10 is better than 2, right? With 10 fingers, you can type fast and saving a few minutes every day or few months during your professional career. We will do that calculation in the next section.
When I say blind typing, I mean typing fast, without looking at the keyboard. If you can do that, you will save a lot of time while typing.
Asking how? Once you learn cycling, you can concentrate on few other stuff like looking traffic, and stuff like listening music while riding your cycle/bike, well, without thinking, your hands automatically control your bike. Similarly, once you learn blind typing, you no longer need to look at your keyboard. You can concentrate on your code, without moving your eyes (on keyboard) while typing code. You need not be professional at 70 words/minute. Average typing speed of 35-40 WPM with blind typing will be a huge productivity boost. For developers, it takes some extra time as we need to master a few special characters like semi-colon, colon, quotes, different braces, a hyphen, mathematical operators, dollar sign (PHP), etc. My blind typing speed (while coding with special characters) is approximately 20-25 WPM but it is more than enough for me (still improving) because as a coder, we can't think more than 25 words/minute, can we?
How to learn blind typing?
You won't get there in a week or a month, it will need practice for months but believe me, it is time worth investing. To start, just install programs like Klavaro (Old plain typing tutor, for serious guys), Tux Typing (with some fun/sound/games) or one of the many typing tutors freely available on Ubuntu (Just google). Just give 15 minutes/day on it and within a month, you will start seeing the difference. If you continue with typing tutor for just 15 minutes/day, within a few months, you will thank me (I will just accept 'Thank you' comment, nothing else).
Well, even though it will be a huge productivity booster and very important, it will need time. Fortunately, a few things mentioned below will give a bit quicker results but do not ignore this step. Pledge to give 15 minutes/day to typing tutor for the next few months (Until you are satisfied with yourself, you have nothing to prove to anyone)
Limit the use of mouse
Again, like blind typing, this will need time to practice. You need time to get rid of your years' long habits. Let's divide this section into two parts; Why and How.
Why?
Some of you may call it useless. It might also not be valid for many (Like UI designers or those who work a lot on Office suite, etc). Again, if it is not valid for you, just skip this long section.
However, we are concentrating on developers, who invest most of the time on their editor/IDE. If you are a developer and do not invest a lot of time on IDE/Editor, no comments, simply skip this section ;).
Coming to why, regardless of operation, every time you touch a mouse, you do following
- Take your hand to mouse/trackpad (assuming you need not look at mouse for that)
- Take the pointer to the required position
- (right) Click/drag (may be multiple times)
- get your hand back to the keyboard.
You spent 1-5 seconds (depending on the operation) compared to pressing a shortcut which takes nearly no time, provided you know blind typing and your fingers are on the home row. (Know about a little bump on keys 'F', 'J', 'Down arrow' and '5' of Numpad?)
How many times you need to switch between mouse and keyboard. Just think, how many following cases apply to you and how frequently:
- Use the mouse to move the cursor to a line just 2-3 lines above/below the current cursor position.
- Select lines/words to copy-paste, or cut-paste (moving code up/down).
- Control + click - Jump to code
- Select IDE/editor menu options
- Change file by clicking on the tabs
- scroll code - mouse wheel or two fingers on the trackpad.
- Change program (You know Alt + tab, good, but there are many more.)
There could be many such operations. Although I do not use the mouse too much (Can't avoid it completely on GUI) and there are no statistics of that so let's work on assumption. Let's assume while development we need to go use the mouse at least once every minute and every time, we waste 1-5 seconds depending on the operation (let's take an average of 2 seconds)
Simple calculation, if we code 6 hours a day (leave two hours for meetings/other stuff) and use mouse once every minute for 2 seconds, we waste 2 seconds * 60 times / hour * 6 hours = 2 * 60 * 6 = 720 seconds = 12 minutes/day. Please note, this is very high level and approximate calculation without any concrete evidence but let's assume it is true for some high-level calculation. Now add the time you waste to find the key on the keyboard and press it with two index fingers. Just improving these two things (blind typing and limiting the use of the mouse) will save 15-20 minutes every day for you.
With this calculation, we waste 1.25 hours every 5 days (workweek) or 6 hours every month (assuming 4 week month for quick calculation). This counts for 12 (months) * 6 (hours) = 72 hours (roughly two workweeks) every year.
Although this might not sound very enthusiastic or valid to many (Everyone thinks differently, and I respect the way you think), I feel, blind typing and limiting the use of the mouse is a huge productivity booster. I can just recommend to give it a try for three months, anything less will not work.
Just extra advice, if your laptop has TrackPoint (A circular rough patch between keys 'G', 'H' and 'B'), just completely disconnect the mouse and disable the touchpad. You can disable trackpad following the article at https://fazlearefin.blogspot.com/2014/08/disable-touchpad-using-keyboard-shortcut.html.
Although just with 6 weeks practice, I use TrackPoint conveniently, effectively and very fast (It is faster than mouse once you have practice), it is inconvenient in the starting. This will force you to focus on keyboard shortcuts rather than on mouse. If you follow this, you should also see how to scroll using Trackpoint at https://askubuntu.com/questions/1040119/dell-latitude-5590-how-to-scroll-with-central-button.
How to limit the use of the mouse?
A golden rule; Don't try to be a pro on day 1, you need practice and patience.
Your operating system (here Ubuntu 18.04, but applicable to all OS) and nearly all software comes with a lot of shortcuts. Our task is just to master these keyboard shortcuts.
Remember, Power users don't have magic, they just know a few extra tricks. Let's start with very basics, let's start with basic OS setup (To be precise, basic OS shortcuts).
Basic Operating System shortcuts
We are discussing Ubuntu (18.04 to be specific) but the same principles can be applied to any Linux flavour, Windows, or Mac.
Quickly switching programs
We all know 'Alt + Tab' and use it frequently to switch programs. However, sometimes we need to press 'Alt + Tab' multiple times to reach the required software and it is limited only to already open programs. Thinking: How can we make sure we reach the required program (including closed programs) with just one shortcut? Before that, if you do not know, the key with 'window' icon (generally between left 'Ctrl' and 'Alt' keys) is called 'Super' key in Linux. We can press 'Super' + 'number key' to quickly jump to program number in the dock. Just check below the image of my laptop.
The trick is to lock the programs on the dock. First, remove all the programs (Right-click and select 'Remove from favourites') from the dock. Then open the programs you most use, in preferred order and lock them on the dock.
Just as in my example, I use 8 programs very frequently, PHP Storm, Google Chrome, Slack, Teams, Visual Studio Code, Files, Postman, and VPN. As you can see in the image above, I locked the first 6 programs in the dock. Unfortunately, I can't lock postman because it is not installed, I've opened it directly through application icon. Thus, as soon as I restart my laptop, I open Postman followed by VPN making them first 8 programs in my dock. Now I've shortcuts like
- Super + 1 = PHP Storm
- Super + 2 = Google Chrome
- Super + 3 = Slack
- Super + 4 = Microsoft Teams
- Super + 5 = Visual Studio Code
- Super + 6 = Files
- Super + 7 = Postman
- Super + 8 = VPN
This keeps Super + 9 and Super + 0 open for any other program if needed. Since I still didn't get used to these shortcuts, I put the stickers to remember the program number on the dock (Why? Because I set the dock to hide, that we will discuss in next section)
Note: Key 6 is the most difficult key to press, at least for me because I use the forefinger of the left hand for pressing key '6'. Now left thumb on super key and forefinger on '6' key is very inconvenient combination and force me to look at the keyboard. Thus, I kept 'Files' on location 6, which I need less frequently than other favourite programs. You must make such minor adjustments based on your preferences, habits, and requirements and they differ for every individual.
Max screen
I developed the habit of using a max screen as my previous MacBook air had just 13-inch screen and I was not using any extra monitor, but it also served the purpose of distraction-free work. At cactus, I've got a laptop with a 15.6-inch screen (which feel too big to me after using MacBook air) as well as an extra 21-inch monitor (which I rarely use, out of habit and because it needs using the mouse).
To achieve part of the max screen, the first thing I do is to make dock autohide. Just a hint, you don't need the mouse to do this
- Open setting
- Press super key (Little equivalent to my Mac's 'Cmd + space')
- It will open the Activities screen, where you can search for applications.
- Type 'Set'
- You can see the application 'Setting' not only visible but also selected.
- Press Enter, Setting will open.
- In setting, press down arrow until you move to 'dock'
- Press right arrow twice (To reach 'on' under 'Autohide dock' option and press enter)
- Press Alt + F4 to close settings.
Which shortcuts we learned
- To open any application, press super key and type first few characters of the application name. Once it is selected, press enter.
- Every application has its keyboard shortcuts. Learn keyboard shortcuts of applications you frequently use.
- Press 'Alt + F4' to close the current application.
Now with dock hidden, we have some extra space (& less distraction) on the screen. However, with a previous trick (Quickly switching programs) we don't need a dock, do we? Even if we need, just take the mouse pointer to the edge of the screen.
One input, that specifically fit me; default ubuntu dock is on the left-hand side but I kept it below. This is because I sometimes connect an extra monitor and it is generally on the left of my laptop. I prefer moving the mouse to left should go to the extra monitor and not to open dock. These all settings are different for different individuals and you need to make settings according to your setup.
Virtual desktops
Almost all Linux comes with virtual desktops including Ubuntu 18.04 (Gnome desktop environment). However, I didn't like the virtual desktop of Gnome, which is available only in one direction (Top-bottom). I prefer the old style of the 2x2 matrix of virtual desktops. I just followed, following question on ask ubuntu to achieve this.
However, this is just my preference, do it only if default workspace does not fit you. I use:
- Workspace 1 (top-left): For everything general, that is not covered on other workspaces.
- Workspace 2 (top-right): For PHP Storm
- Workspace 3 (Bottom-left): For communication (Slack and teams). Do it yourself trick, see what happens when you press Super + arrow keys. (Hint: It will adjust your program windows on your screen and you can see two programs side by side)
- Workspace 4 (Bottom-right): VS Code. I use the VS code for my markdown notes. Its just git repo with markdown files. I wrote this article there only. It is also used for smaller side/personal projects, learning new things, experimenting code etc.
With this 2x2 grid, I currently prefer moving with 'Ctrl + Alt + arrow' but started using this less with getting used to `Super + number' shortcut. I'll probably soon remove it but it is a good set up before you get habitual of 'Super + number' shortcut.
With this, I feel we have a basic OS setup for a more productive day. This article has gone a little too big and my setup is still not completely documented. I'll soon publish remaining parts of our table of contents and whatever new I learn. I'll put a link below as soon as they are published.
Application Support|Production Support|DevOps Engineer|Azure DevOps
4 年Nice article Kapil & well organised to keep it interesting on read too. It was really helpful & I adopted few of these tricks already.