5 Simple tips and tricks to boost your productivity in the terminal

An image of a terminal

In this post I will show you a few simple tips and tricks to increase your productivity using the terminal in linux. Try to memorize these tips and tricks as you will need them as a webdeveloper.

1. Use autocompletion

The linux terminal has a very nice autocompletion feature. To use it, just type the first few letters of the command or directory and then press tab. If there are multiple options, the terminal will show you what it found. Just type the next letter to narrow the list.

Autocompletion in action, a simple trick in the linux terminal

2. Run last command as sudo

Don’t you hate it when you type a long command for which you need root permissions and you forgot to type sudo infront of it? Don’t worry, here’s a useful tip for you! Just type sudo !! to execute the last command you entered as with sudo.

Bonus tip: If you just want to repeat the last command, because for example you want to view the contents of a changed file again, just type !!. This will repeat the last command.

Sudo !! in action - A simple tip for your linux terminal productivity

3. Searching for text in a file

When working with large log files, it can be really tedious to find that one exception or log entry among the huge amount of text. Not to worry! Just type the following command: cat YOURFILE | grep "THE TEXT TO SEARCH FOR" when you run this command you’ll only receive the lines of the log file that contain the text you search for. Really useful!

4. Return to home

After a hard day at work we all want to return to home. If it only were as easy as in linux. In linux you can just type cd ~ and you’ll be taken straight to your home directory. Can’t get any easier!

5. Return to the previous directory

If you’re switching around directory all the time, it can be really annoting having to type ../ all the time. To combat this you can switch between two directories really fast by typing cd -.

Do you have more productivity tips? Share them in the comments!


  1. playing with `~/.bash_aliases` is very useful
    for instance, created a list of aliases to go to some directories
    `@code`, `@www`, `@project_name`

    also added quite some functions and shortcuts for commands
    for instance, things like
    `alias ggl=’git log –oneline –graph –all –decorate’`
    `alias gggdiscard=”git clean -df; git checkout — .”`

    or functions:
    `ggstats() {
    git log –shortstat –author=”$(git config user.name)” | grep -E “fil(e|es) changed” | awk ‘{files+=$1; inserted+=$4; deleted+=$6; delta+=$4-$6; ratio=deleted/inserted} END {printf “Commit stats:\n- Files changed (total).. %s\n- Lines added (total)…. %s\n- Lines deleted (total).. %s\n- Total lines (delta)…. %s\n- Add./Del. ratio (1:n).. 1 : %s\n”, files, inserted, deleted, delta, ratio }’ –
    etc etc

Leave a Reply

Your email address will not be published. Required fields are marked *