Skip to content

Viewing files

Reading configuration files, logs and other files without changing them, from short text files to compressed logs and binary files.

Basics: Reading logs: the right command for each task

Show the whole file

  • cat


    Print files and join them together.

  • tac


    Print a file backwards, last line first.

  • nl


    Print a file with line numbers.

Read page by page

  • less


    Scroll, search and follow large files and logs.

Beginning and end

  • head


    Show the first lines of a file.

  • tail


    Show the last lines of a file and follow logs live.

Compressed files

  • zcat


    Print gzip-compressed files without unpacking them.

  • zless


    Browse and search compressed files page by page.

Binary files

  • hexdump


    Show the bytes of a file in hexadecimal.

  • strings


    Pull readable text out of binary files.