Use ctrl+x+e as a tool to easily edit command line text
Himanshuz.chd 270004408M Comments (2) Visits (8554)
A few days back, I was trying to find details of a specific type of files on my Ubuntu box in office.
Here is what I was trying to do :
find ./ -name "*.out" | xargs ls -lart
As you can see that I was trying to list out the details of all the files having .out extension. So far so good as I got what I wanted. Then one of my colleague wanted to use the same command on his Linux machine so he asked me to copy and send it to him. Though copying from command line using mouse and keyboard is not that difficult but somehow after I selected the command text, I pressed ctrl+c as usual and as expected, it did not work as ctrl+c is on command line is not used for copying. Though next time I was able to copy through mouse but now I wanted to learn a way through which editing or copying long commands from command line becomes easy.
I googled a bit and found this cool trick that copies the command line text to an editor.
Here are the steps do it:
So as you can see that it's quite an easy trick.
So at this point, not only you can copy the text but any modification in the command would also be treated as modification in the actual command line command and results will alter accordingly.
To test this, I replaced the 'ls -lart' with 'wc' command, saved the text file and then closed it. The next two snapshots show that the modification was actually reflected in the command line results.