First, find out what your most commonly used commands are, by running the below command.
history | awk '{print $1}' | sort | uniq -c | sort -nr | head -n 15
For me, it was the following.
431 git
122 ptw
109 yarn
100 sudo
65 cd
51 docker
36 find
34 rm
31 pip
31 ls
23 cat
20 pyenv
20 kill
16 gpg
To save time, over time. We can either try to remove commands or shorten the amount we need to type to execute them.
In my case, I added shell aliases for the following commands to shorten them.
g -> git
d -> docker
y -> yarn
f -> find
Sudo has to stay, but we can remove the need to have to keep typing in a password by taking the following steps.
- Type ‘
sudo visudo
‘ - In the file which opens in your editor, add the following line to the bottom, replacing ‘<your_username>’ with your system login username.
<your_username> ALL=(ALL) NOPASSWD: ALL
After this, you can type ‘sudo whatever command’ in a terminal without being prompted for the password.
That’s it. Although these changes seem minor, over time, you can save yourself a significant amount of time using these methods.
Do you have any tips to speed up your workflow and save time? If so, share them below!