linux view text file code example

Example 1: linux command to view file

cat command.
less command.
more command.
"gnome-open command" or "xdg-open command" (generic version) or "kde-open command" (kde version) – Linux gnome/kde desktop command to open any file.
open command – OS X specific command to open any file.

Example 2: find text in linux file

grep 'word' filename
grep 'word' file1 file2 file3
grep 'string1 string2'  filename
cat otherfile | grep 'something'
command | grep 'something'
command option1 | grep 'data'
grep --color 'data' fileName

Example 3: linux check file contetns

cat "fileName"