Reading Text Files

Commands

more

  • more - look at the content of a text file page by page, by only moving forward in a file. Press q to quit.

less

  • less - look at the content of a text file, with more options than the more command, like line by line, up and down navigation, moving, searching, jumping.

    • Search is possible by using the slash - /word_to_search

    • Press q to quit.

# Some "less" Commands and Actions
Down arrow, Enter, e, or j - Move forward one line.
Up arrow,y or k	- Move backward one line.
Space bar or f - Move Forward one page.
b - Move Backward one page.
/pattern - Search forward for matching patterns.
?pattern - Search backward for matching patterns.
n - Repeat previous search.
N - Repeat previous search in reverse direction.
g - Go to the first line in the file.
Ng - Go to the N-th line in the file.
G - Go to the last line in the file.
p - Go to the beginning of fthe ile.
Np - Go to N percent into file.
h - Display help.
q - Exit less.

cat

  • cat - Concatenate or link the content of different files to standard output.

    • Useful when combined with redirection of the output.

  • Display file contents:


Last updated

Was this helpful?