Viewing contents of a file in Linux

You can use any of the below commands to view the file contents.

  1. cat <file-name>
  2. head <file-name>
  3. tail <file-name>
  4. tac <file-name> : This command displays file from bottom to top
  5. less <file-name>
  6. more <file-name>
  7. awk ‘1’ <file-name>
  8. sed -n ‘1,$p’ <file-name>
  9. grep “.” <file-name>
  10. text editors like nano, pico, vi, emacs

You may also like...