What are alternatives to `cat`?

073

There are several alternatives to the cat command in Linux for viewing and manipulating file contents:

  1. less: A pager that allows you to view the content of files one screen at a time. It supports backward and forward navigation.

    less filename.txt
  2. more: Similar to less, but with more limited navigation options. It displays the content one screen at a time.

    more filename.txt
  3. head: Displays the first few lines of a file (default is 10 lines).

    head filename.txt
  4. tail: Displays the last few lines of a file (default is 10 lines). It can also follow a file in real-time with the -f option.

    tail filename.txt
    tail -f filename.txt
  5. tac: Displays the contents of a file in reverse order (last line first).

    tac filename.txt
  6. nl: Displays the contents of a file with line numbers.

    nl filename.txt

These commands provide various functionalities for viewing and manipulating file contents, depending on your needs.

0 Comments

no data
Be the first to share your comment!