Visa textfiler i Terminal på datorn
Om du vill visa innehållet i en textbaserad konfigurationsfil använder du cat
eller less
.
I allmänhet använder du less
, eftersom det har fler alternativ (som sökning).
Om du vill använda less
anger du kommandonamnet följt av namnet på filen du vill visa. Den första sidan med text fyller fönstret. Tryck på mellanslag för att visa nästa sida.
Med verktyget less
kan du även söka i en fil. Skriv in / följt av frasen du söker efter. Om frasen innehåller mellanslag ska varje mellanslag föregås av \:
/I\ read\ the\ other\ day
Följande tabell anger några andra tangenter som är användbara för att navigera i utdata från less
.
Kortkommando | Åtgärd |
---|---|
J eller nedåtpil | Rulla nedåt en rad |
K eller uppåtpil | Rulla uppåt en rad |
N | Sök efter nästa förekomst av en sökterm |
P | Sök efter föregående förekomst av en sökterm |
Q | Avsluta |