Author Topic: Actually a UNIX question but...  (Read 2369 times)

Offline Timenn

  • Gameheaven Staff
  • Team Leader
  • *****
  • Posts: 1.166
  • Reality is just a special case of the possible.
    • The Shai-Hulud mod website
Actually a UNIX question but...
« on: October 01, 2003, 11:40:21 am »
...But maybe some of you Linux dudes :) will know the answer, since my question is about shell commands.
You know when you have typed and executed a command that it is stored in memory, and that you can get the command by using the up and down arrows. And that way you can scroll through your used commands.

But is there a way to define that a command is only stored once, even when you used it several times after each other. It's like you use these commands in a row:
$ date
$ ls -l
$ ls -l
$ ls -l
$ who
$ (and now when you want to scroll to the command "date", that you won't have to scroll through "ls -l" 3 times, but only once)

This may look lazy, but it can be annoying when you have compiled your own written program, then execute it 20 times, and then you want to compile it again because you made modifications to it in a text editor.

Offline number6

  • Be seeing you.
  • Gameheaven Staff
  • Team Leader
  • *****
  • Posts: 1.427
Re:Actually a UNIX question but...
« Reply #1 on: October 01, 2003, 02:07:45 pm »
I hardly ever scroll through the command history. What I use is the "!" to get old commands out of the history. Say you did your date example as your last command you could type:

"!!"

and that would run the last command in your command line history. Say you typed a couple of "ls" commands in between your date command and you want the date again you could type:

"!d"

and that will run the last command that started with the letter "d".
« Last Edit: October 02, 2003, 01:57:50 am by number6 »

Offline Timenn

  • Gameheaven Staff
  • Team Leader
  • *****
  • Posts: 1.166
  • Reality is just a special case of the possible.
    • The Shai-Hulud mod website
Re:Actually a UNIX question but...
« Reply #2 on: October 02, 2003, 04:06:12 pm »
Ah, thanks. That will help too.
I presume that it will work too when you use more then one symbol?
like "!ipc" and "!ipi" ?

Offline number6

  • Be seeing you.
  • Gameheaven Staff
  • Team Leader
  • *****
  • Posts: 1.427
Re:Actually a UNIX question but...
« Reply #3 on: October 02, 2003, 04:24:29 pm »
Yes you are correct with that assumption.