10 essential tips to speed up software development on Linux

General

10 essential tips to speed up software development on Linux

Developers who always use Linux can not shut up about it because it is actually that good. It feels like you are coming out of the abstraction cage and you have control over everything. For once. Here are some tips to make software development on Linux highly productive and fun at the same time!

1. Tab for autocompletion

This feels like the obvious, but I have seen many beginners who did not know about this basic feature. Whenever you are typing a command, you can press TAB halfway to autocomplete it. It's that simple.

2. Back to the last working directory

Everybody knows that with "cd" you can go into a directory and with "cd .." you can go a step back in the directory path. But what a lot of people don't know is with "cd -" you can go to the previous directory you were in. That's pretty useful if you ask me.

cd      # go into the directory
cd ..   # go a step back in the directory path 
cd -   # go to the previous directory you were in

3. The mighty !!

Sudo is important. But sometimes we forget to prefix sudo with a command. Normal people would type the same command again with sudo. You don't have to be normal. Use the mighty !!. You can get the previous command in exchange for a couple of exclamations ( !! ).

sudoc@ubuntu:~> makesometea
Permission denied. Root privileges are required to run this command
sudoc@ubuntu:~> sudo !!
Success! tea on the way.

4. Get back the CTRL

Here are some simple CTRL+ commands that you can easily remember

CTRL+A    # move the cursor to beginning of the command ( remember that A is the first letter in the alphabet )
CTRL+E    # move the cursor to the end of the command ( remember E is for the end )
CTRL+U   # clear the line and do a fresh start

5. We have history

If you have a clear console/line, you can use the below command to see the history of the run commands

history

With this, you got to copy and paste the required command. But, there is a lazier and clever way. You can just run CTRL+R, the reverse search. Then use the bottom arrow to get previous commands one at a time. Then click enter to run your command.

6. Aliases

This is one of my favorite ways to save time. You can assign a word i.e an alias to some frequently used long commands. To do this, you need to edit the .bashrc file. This file contains all the commands that run as soon as the computer boots up. It can be found in the root folder.

sudoc@ubuntu:~> nano ~/.bashrc

# edit this file and add alias setting line. For example:
alias shortName="your custom command here"
alias maketea="cd projecttea && ./make_an_awesome_tea.sh"

# reboot or source the .bashrc
sudoc@ubuntu:~> source ~/.bashrc

now just run maketea and enjoy the tea.

7. bat

If you are a cat person, I recommend you to become a bat person. "bat" is just a "cat" with wings. For real. If you want to preview a file, you can use the Linux default command:

sudoc@ubuntu:~>  cat filename.txt

But, bat is even better. You need to install it with:

$ sudo apt install bat

Example bat eye view looks like this 68747470733a2f2f692e696d6775722e636f6d2f326c53573452452e706e67.png

8. Fuck

I apologize for the language, but it is a pretty cool tool in Linux. You can immediately correct the typos in the command with this magic word. Install it on ubuntu distro with

$ sudo apt update
$ sudo apt install python3-dev python3-pip python3-setuptools
$ pip3 install thefuck --user

The example use of this command

➜ git brnch
git: 'brnch' is not a git command. See 'git --help'.

Did you mean this?
    branch

➜ fuck
git branch [enter/↑/↓/ctrl+c]
* master

You don't have to shout this word anymore when you type a wrong command. Just type it instead.

9. Byobu

This is another tool that I cannot live without anymore. You can split a single console into multiple consoles horizontally or vertically. You can open and close a new session ( kinda tab ) with some real easy shortcuts. Install it with:

$ sudo apt install byobu

It looks something like this maxresdefault.jpg

10. Cowsay

There are some not so useful, but fun tools built inside Linux that you can use when you are bored. For example, you can make Linux cow say anything you want

"Typical cowsay output!" | cowsay 

Cowsay_Typical_Output.png

That's all for now. I will come back with some more advanced tips and tools for Linux in the near future. Stay tuned!

More Posts

Web of Things ( WoT ) Explained
General

The Internet of Things has revolutionized the way we interact with our devices, but it also brings new challenges in terms of interoperabili...

Git commit best practices
General

This post explains how to write good commit messages and how not to write bad commit messages. Also, you will learn some more best practices...

What is an RTOS?
Device Software

RTOS or a Real-Time Operating system is an operating system usually running on an embedded device that can run time-constrained applications...