Viewing File Contents
cat
cat [-n] <file-name>
n : Display line numbers
- Displays the contents of the file.
cat a b > c # Concatenate files "a" and "b" into the new file "c"
cat -n info.txt
cat -n info.txt | more # Display one screenful at a time)
info
info <filename>
n : Next node
p : Previous node
u : Parent node
space : Next node, or page-forward in a large node (if not already at the bottom)
backspace : Previous node, or page-backward in a large node (if not already at the top)
less
less <file-name>
<command> | less
- Like more, but lets you scroll backwards as well as forwards
ls -al | less # View the directory listings
more
more <file-name>
- Displays the contents of the file one screenful at a time; continue to the next page by pressing the space bar.
tail
tail <filename>
- By default, prints the last 10 lines of the file to standard output