Linux Konsole

forumjoe

Neuling
Thread Starter
Mitglied seit
02.10.2006
Beiträge
32
Folgendes kleine Problemchen:

Wenn ich unter Linux in der Konsole arbeite, kann ich ja meine Befehle eintippen,
diese ausführen und dann mit den Pfeiltasten durch diese navigieren.

So weit so gut, aber wenn ich einen Befehl sagen wir mal 10 Mal benutze,
dann ist der auch 10 Mal in dieser Liste...

Nun zu meinen Fragen:

Kann man das einstellen, dass jeder Befehl da nur einmal drinn steht,
egal wie oft ich diesen ausführe und wie geht das?

Wie kann ich die komplette Liste löschen oder auch ne Anzahl der maximal gespeicherten Befehle setzen?
 
Wenn Du diese Anzeige nicht sehen willst, registriere Dich und/oder logge Dich ein.
ein simples "man history" spuckt unter anderem das hier aus:

Code:
history [n]
history -c
history -d offset
history -anrw [filename]
history -p arg [arg ...]
history -s arg [arg ...]
              With no options, display the command history list with line num-
              bers.  Lines listed with a * have been modified.  An argument of
              n  lists only the last n lines.  If the shell variable HISTTIME-
              FORMAT is set and not null, it is used as a  format  string  for
              strftime(3)  to display the time stamp associated with each dis-
              played history entry.  No intervening blank is  printed  between
              the  formatted  time stamp and the history line.  If filename is
              supplied, it is used as the name of the history  file;  if  not,
              the  value  of HISTFILE is used.  Options, if supplied, have the
              following meanings:
              -c     Clear the history list by deleting all the entries.
              -d offset
                     Delete the history entry at position offset.
              -a     Append the ‘‘new’’ history lines (history  lines  entered
                     since  the  beginning of the current bash session) to the
                     history file.
              -n     Read the history lines not already read from the  history
                     file  into  the  current  history  list.  These are lines
                     appended to the history file since the beginning  of  the
                     current bash session.
              -r     Read the contents of the history file and use them as the
                     current history.
              -w     Write the current history to the history file,  overwrit-
                     ing the history file’s contents.
              -p     Perform  history  substitution  on the following args and
                     display the result on  the  standard  output.   Does  not
                     store  the results in the history list.  Each arg must be
                     quoted to disable normal history expansion.
              -s     Store the args in the history list  as  a  single  entry.
                     The  last  command  in the history list is removed before
                     the args are added.

              If the HISTTIMEFORMAT is set, the time stamp information associ-
              ated  with  each  history  entry is written to the history file.
              The return value is 0 unless an invalid option  is  encountered,
              an  error  occurs  while reading or writing the history file, an
              invalid offset is supplied as an argument to -d, or the  history
              expansion supplied as an argument to -p fails.
 
Danke für die Hilfe :)

Nun kann ich wenigstens die Einträge mal ab und an löschen.


:confused: Jedoch bleibt irgendwie das Problem,
das die Einträge mehrfach aufgelistet werden,
was mich halt noch stört...
 
<user> pwd
/home/xy
<user> pwd
/home/xy


Das soll also nur 1x angezeigt werden?
Oder verstehe ich da was falsch?
 
Ja, genau so sollte es denn sein, wenns natürlich geht ;)

Denn wenn ich immer wieder die Selben Befehle ausführe,
dann wird dadurch die Liste ja ewig lang...
 
Ich denke mal das das erstmal keine rolle spielen sollte,
welche befehle ich x mal hintereinander ausführe...
sicher könnte ich dies über scripte vereinfachen,
aber das ist nun mal leider nicht sinn und zweck dieser sache.

Sonst würde ich ja nicht nach solch einer lösung fragen ;)
 
ist zwar etwas ot aber wenn du ein befehl ausführst der nur etwas ausgeben soll
könntest du auch z.b. mit tail arbeiten, also nur die änderungen der Datei ausgeben.
 
Hardwareluxx setzt keine externen Werbe- und Tracking-Cookies ein. Auf unserer Webseite finden Sie nur noch Cookies nach berechtigtem Interesse (Art. 6 Abs. 1 Satz 1 lit. f DSGVO) oder eigene funktionelle Cookies. Durch die Nutzung unserer Webseite erklären Sie sich damit einverstanden, dass wir diese Cookies setzen. Mehr Informationen und Möglichkeiten zur Einstellung unserer Cookies finden Sie in unserer Datenschutzerklärung.


Zurück
Oben Unten refresh