Useful bashrc functions
I’m going to share some of my bashrc functions which saves me a lot of time.
This function helps you find a process using a keyword and to kill it, you don’t have to use ps aux along with grep and then kill the process by entering the pid instead use this function give it a keyword and it will help you in killing a process.
usage : killer chromium
You will given a list of application which has similar name chromium and proceed with a yes or no.
[ Update This is not so useful function anymore you may use in built pkill command to get the same result. ]
Search and cd combined
This function will help you to search and cd into a folder in a single step.
Now you may be wondering the reason for using the primitive style of saving result into a variable and then cd’ing into it. I tried using exec with find, but the exec expects a executable binary (something of the sort /bin/bash ) and cd is a shell bultin,which means you will have to leave the parent shell to cd into a folder ( the desired folder ).A one liner for the same will look something of this sort.
Also note that you will taken into a new shell and changes that you make in the new shell will not be reflected back in the parent shell, and its a pain to exit each and every shell you create during the process.
You can have a look at my stackoverflow post regarding the doubts that I had with this implementation.
If you have any suggestion to improve the thing please let me know through a comment.
usuage : scd Music
Will take you to Music folder, regardless of your present working directory
Mkdir and cd into it in a single step
Usually we have to create a folder and then cd into it, atleast to me I had to do this very often.
Due to my poor vocabulary I always had to look for the meaning of English words from dictionary.com. So to make things easier, I wrote a bash script to fetch meanings from dictionary.com within my terminal.