Few months back , i shifted from .net development to Ruby on Rails. The most difficult part for me was shifting from windows platform to Linux platform because i had never used linux ever before. I installed Ubuntu 16.4 along with my windows 8.1. I got a lot of help from my Ruby on Rails Instructor for setting up Ubuntu and all related tools required for developing Ruby on Rails app but it was me who had to learn all the basic tricks for being familiar with linux.
Here i will be sharing the various tricks for using various features of Ubuntu . In this first part of Tutorial titled "Basic Ubuntu Tricks for Developers" , i will start with very basic commands.
1. Copy and Paste in Terminal [Ctrl+c, Ctrl+v]
Problem: I really didn't know the differences between terminal in ubunutu and cmd prompt in windows regarding to copy-paste command. So i tried using ctrl+c and ctrl+v to do copy-paste in terminal ..:) really it was frustrating seeing it was not working
Solution: you have to use Alt+Ctrl+c to copy and Alt+Ctrl+v to paste in terminal in ubuntu. Simply Ctrl+c and Ctrl+v doesn't work here.
2. Retyping commands in Terminal [ up and down arrow]
Problem : I used to make a lot of mistakes while typing commands in terminal . After pressing Enter it wouldn't work and i would retype the command correcting the mistake. It was a lot of efforts i have to put to rewrite the long commands. i often use to copy command in text Editor and copy and paste from there instead of rewriting the commands again and again.
Solution : Later i learned that you can use up and down arrow key to go back and forth to already used commands. Then you can edit the command using backspace and re-Enter the command. Now you don't have to retype the already used command or do copy paste by saving in text editor. All the used commands are saved in terminal and you just have to use up and down arrow to find it.
3. Clearing History of Terminal [sudo gedit .bash_history]
Problem: In history all typed commands were saved. Those were not all i wanted and it was confusing to select the right one and from hundreds of them.Using up and down to select the right one from hundreds of typed commands was frustrating.
Solution. First you have to know that the typed commands are saved when you closed the terminal manually by clicking on cross on upper right. If you exit terminal by shutting down your pc ,it may not be saved. So, there is a trick to save the session of commands or to discard them based on how you close your terminal.
If you use the command "sudo gedit .bash_history" , you will get a editor full of all typed command. you can remove the commands that you don't need or add some more commands you use frequently . Save it and you are done. Next time when you use up and down you will see only those commands but everytime you use terminal , all the commands you time each time will be added there.
4. Adding New Tab on Terminal [ Ctrl+Shift+T]
Problem: I used to create new terminal each time i wanted to work on two or more terminals and it was not easy to shift from one another.
Solution: Use Ctrl+Shift+T keyboard shortcut to create new tab on same terminal. you can write as many tabs as you can want on same terminal. It will be very easy work on different tabs then creating different new terminals.
Soon i will be back with part 2 with more Ubuntu tricks and tools ,useful for developers,that i have learned . Do let me know if it helped you in any way or i if i did any mistakes while typing instructions here. Thanks