You are not logged in.
Pages: 1
I'm wondering if there is a simple way to re-use commands when using the terminal. Consider the following:
$ mkdir /mnt/photo/2008
$ mv *.jpg /mnt/photo/2008
Doing this I used /mnt/photo/2008 twice, is there some simple way I can re-use what I issued to mkdir, in this case /mnt/photo/2008. The shell is zsh, I know I can assign a variable but this does not save time when just doing that ...
We met up with the aliens and guess what? They have no word for fluffy!
Offline
Use the up arrow to get the previous command, C-a to move to the beginning of the line, delete the first word and type the new command?
Oh, there's also some fancy things you can do with the history command and '!' keyword. I never learned those though.
Last edited by peets (2008-12-28 17:22:23)
Offline
Offline
Use the up arrow to get the previous command, C-a to move to the beginning of the line, delete the first word and type the new command?
Oh, there's also some fancy things you can do with the history command and '!' keyword. I never learned those though.
The fancy stuff is what I want. I've tried to google, but I guess I use the wrong search words
We met up with the aliens and guess what? They have no word for fluffy!
Offline
I've tried to google, but I guess I use the wrong search words
man history
Offline
Also Alt+. (dot) by default to fill it in in the prompt.
Offline
$ mkdir /mnt/photo/2008 $ mv *.jpg !$
That's the right answer, but it got ignored, why?
Have you Syued today?
Free music for free people! | Earthlings
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery
Offline
tdy wrote:$ mkdir /mnt/photo/2008 $ mv *.jpg !$
That's the right answer, but it got ignored, why?
Sorry, must have been posted while I wrote the earlier msg. Thank you very much tdy and the rest of you
We met up with the aliens and guess what? They have no word for fluffy!
Offline
Also Alt+. (dot) by default to fill it in in the prompt.
Didn't know about this one.. quite handy. Thanks!
Last edited by tdy (2008-12-28 18:19:07)
Offline
@tdy: there's a full list in man readline
Offline
$ mkdir /mnt/photo/2008 $ mv *.jpg !$
Wow!
Great! Thank you tdy
Shaika-Dzari
http://www.4nakama.net
Offline
another trick that i use quite frequently is the ^ for substitution. for instance:
myprompt > ls /etc/foobar.conf
myprompt > ^ls^nano
it's also really handy for correctly spelling mistakes in the previous command. i think it respects normal bash quoting, so ^mkdir^'mv *.jpg' might work for you.
[23:00:16] dr_kludge | i want to invent an olfactory human-computer interface, integrate it into the web standards, then produce my own forked browser.
[23:00:32] dr_kludge | can you guess what i'd call it?
[23:01:16] dr_kludge | nosilla.
[23:01:32] dr_kludge | i really should be going to bed. i'm giggling madly about that.
Offline
Pages: 1