Ctrl-R is one of the most useful commands on the terminal and it allows to browse through command history and re-use it again. On bash shell there is a much simpler way to search through your command history on terminal. Basically you can start typing the initial letter and then use up and down arrow […]
“with” statement in Python to Open a file
A common way to work with files in Python is to create file handler with “open” statement and work with the file. After finishing the work with the file, we need to close the file handler with close statement. For example, if we want to read all lines of a file using Python , we use […]
25 Tips to Move Around in Vim
h Move left j Move down k Move up l Move right w Move to next word W Move to next blank delimited word b Move to the beginning of the word B Move to the beginning of blank delimited word e Move to the end of the word E Move to the end of blank delimited […]
17 Emacs Commands to Get Started
Ctl-a Beginning of line Ctl-e End of line Ctl-k Delete from cursor position to end of line Esc-a Begining of a sentence, if each sentence is eperated by two blanks Esc-e End of a sentence, if each sentence is seperated by two blanks Esc-k Delete from cursor to end of sentence, if each sentence is […]
How to Run a Shell Command from Python and Get The Output?
In Python, often you may want to execute linux command and get the output of the command as string variable. There are multiple ways to execute shell command and get output using Python. A naive way to do that is to execeute the linux command, save the output in file and parse the file. Get […]