Here’s a really quick but very useful tip. You’re half way through writing a command line when you realise you need to do something before you run that command. For the sake of example, let’s say you’re in the wrong directory, so you type ^U
to delete the current command line (the ^U
isn’t echoed, but I’ve put it in for clarity) and you cd
to the correct directory:
$ for a in *.py; do ^U $ cd git/python /home/kae/git/python $
So now you have retype your original command, the for
loop. Well, no: if you type ^Y
, the last line that you deleted with ^U
will be redisplayed for you to edit (again, the ^Y
isn’t echoed but I’ve shown it for clarity):
$ ^Y $ for a in *.py; do
Do You Have Any Similar Tips?
Let us know in the comments below.