-
Notifications
You must be signed in to change notification settings - Fork 3
Bash: Less command and navigate
Michael Watts edited this page Sep 14, 2015
·
1 revision
http://www.thegeekstuff.com/2010/02/unix-less-command-10-tips-for-effective-navigation/
-
/
– search for a pattern which will take you to the next occurrence. -
n
– for next match in forward -
N
– for previous match in backward
-
?
– search for a pattern which will take you to the previous occurrence. -
n
– for next match in backward direction -
N
– for previous match in forward direction
-
CTRL+F
– forward one window -
CTRL+B
– backward one window -
CTRL+D
– forward half window -
CTRL+U
– backward half window
In a smaller chunk of data, where you want to locate particular error, you may want to navigate line by line using these keys:
-
j
– navigate forward by one line -
k
– navigate backward by one line
-
G
– go to the end of file -
g
– go to the start of file
When you are viewing a large log file using less command, you can mark a particular position and return back to that place again by using that mark.
-
ma
– mark the current position with the letter ‘a’, -
'a
– go to the marked position ‘a’.
Similar to Vim editor navigation command, you can give 10j to scroll 10 lines down, or 10k to go up by 10 lines.
-
10j
– 10 lines forward. -
10k
– 10 lines backward.
-
q
orZZ
– exit the less pager -
v
– using the configured editor edit the current file. -
h
– summary of less commands -
&pattern
– display only the matching lines, not all. -
CTRL+G
– show the current file name along with line, byte and percentage statistics.