5 Linux Command power your productivity

In this post let’s focus on 5 hands-on Linux command that increases your productivity. If you are new in Linux world may those commands makes more comfortable to work on the terminal in the early days.

  1. cd(change directory) + -(dash): This command takes you to in your last directory. See the example below:
#you are in system directory, then changed to
de@de:mosaiq@debian:/etc/systemd/system$ cd ~/var/log/apt

2. sudo !! is also one of my favorite commands that allows you to perform previously command with sudo right.

Let’s say you are configuring some network stuff and want to move a configuration file to /etc directory as below:

de@de:~/codebase/medium$ ls
networking nexus-automation
de@de:~/codebase/medium$ mv networking /etc/
mv: cannot move ‘networking’ to ‘/etc/networking’: Permission denied

3. hostname -I give you IP address without full content of ip addr show or ifconfig(legacy).

# if you need only ip address, simply:
de@de:~$ hostname -I

4. alias save your time to type long commands. Especially,if you are working on cloud-native environment which increased remarkably last few years such as Docker, Kubernetes, AWS… UNIX-like environments. You need to run some long commands often. In those case, an alias is a perfect tool. See in the example:

#here I am running jenkins container on port 8080
$ docker run — rm -d -p 8080:8080 -v $(pwd):/var/jenkins_home my_jenkins

If you know docker, when you run a container you have to always type docker run — rm -d then other custom stuff. Let’s make an alias. The syntax to define an alias:

alias <your_custom_name>=’linux_command’

# I gave name as dr
de@de:~$ alias dr=’docker run — rm -d’

To see your alias: run in terminal alias. To make them persistence then add them to the following file: .bash_alias

See how it looks on my machine

5. Ctrl+z → Job control — backgrounding, foreground

Let’s say you are editing a configuration file via vim and you’re not done, but have to perform another task, simply CTRL + Z then vim will run on background and the terminal is available to use it. Whenever you need to back to the configuration file type just: fg

fg = foreground

As you see above, while I editing interface file I just hit Ctrl+z and the jobs move to the background, I created a directory named test then type fg move your background process to the foreground.

I hope those commands help you to speed up your terminal usage :)

* https://www.redhat.com/sysadmin/cli-speedup
* https://wiki.ubuntuusers.de/Startseite/
* https://developers.redhat.com/

Computer Science And DevOps things :)