Skip to main content
Commonmark migration
Source Link

It seems that the purpose of cat is to concatenate several files. However, many people still use cat instead of less (or a similar program like more) to display a file. See, for example, the GNU m4 manual and the answer "How can I display the contents of a text file on the command line?".

Man page: less

###Man page: less -F or --quit-if-one-screen

     Causes less to automatically exit if the entire file can be displayed on the first screen.

-X or --no-init

     Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.

Nowadays, is it a good practice to use cat to display or view a file? Why use cat to view a file?

This makes me think to Useless Use Of Cat.

Note: This question is not about the differences between less and more. Moreover, it concerns the visualization of a file created earlier.


According to the answers and comments, it seems that cat is used beyond its use because it is easier to use than a pager (e.g. more, less...). Some people think this is an irrelevant fact (or useless) but experience shows that various subtleties pertaining to the shell may have practical consequences: use a shell loop to process a text file, use unquoted variables...

Negative consequences vary in intensity. For example, cat foo bar | less is valid because the user concatenates two files but cat foo | less is not valid. In the same spirit, cat seems to be required in "a pipeline" although it seems that a pager like less works in a pipeline too (note: less is not suited in all cases concerning displaying, e.g. Reading a named pipe: tail or cat?).

See also: How to cat a file with "or" options

It seems that the purpose of cat is to concatenate several files. However, many people still use cat instead of less (or a similar program like more) to display a file. See, for example, the GNU m4 manual and the answer "How can I display the contents of a text file on the command line?".

###Man page: less -F or --quit-if-one-screen

     Causes less to automatically exit if the entire file can be displayed on the first screen.

-X or --no-init

     Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.

Nowadays, is it a good practice to use cat to display or view a file? Why use cat to view a file?

This makes me think to Useless Use Of Cat.

Note: This question is not about the differences between less and more. Moreover, it concerns the visualization of a file created earlier.


According to the answers and comments, it seems that cat is used beyond its use because it is easier to use than a pager (e.g. more, less...). Some people think this is an irrelevant fact (or useless) but experience shows that various subtleties pertaining to the shell may have practical consequences: use a shell loop to process a text file, use unquoted variables...

Negative consequences vary in intensity. For example, cat foo bar | less is valid because the user concatenates two files but cat foo | less is not valid. In the same spirit, cat seems to be required in "a pipeline" although it seems that a pager like less works in a pipeline too (note: less is not suited in all cases concerning displaying, e.g. Reading a named pipe: tail or cat?).

See also: How to cat a file with "or" options

It seems that the purpose of cat is to concatenate several files. However, many people still use cat instead of less (or a similar program like more) to display a file. See, for example, the GNU m4 manual and the answer "How can I display the contents of a text file on the command line?".

Man page: less

-F or --quit-if-one-screen

     Causes less to automatically exit if the entire file can be displayed on the first screen.

-X or --no-init

     Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.

Nowadays, is it a good practice to use cat to display or view a file? Why use cat to view a file?

This makes me think to Useless Use Of Cat.

Note: This question is not about the differences between less and more. Moreover, it concerns the visualization of a file created earlier.


According to the answers and comments, it seems that cat is used beyond its use because it is easier to use than a pager (e.g. more, less...). Some people think this is an irrelevant fact (or useless) but experience shows that various subtleties pertaining to the shell may have practical consequences: use a shell loop to process a text file, use unquoted variables...

Negative consequences vary in intensity. For example, cat foo bar | less is valid because the user concatenates two files but cat foo | less is not valid. In the same spirit, cat seems to be required in "a pipeline" although it seems that a pager like less works in a pipeline too (note: less is not suited in all cases concerning displaying, e.g. Reading a named pipe: tail or cat?).

See also: How to cat a file with "or" options

deleted 19 characters in body
Source Link
user286944
user286944

It seems that the purpose of cat is to concatenate several files. However, many people still use cat instead of less (or a similar program like more) to display a file. See, for example, the GNU m4 manual and the answer "How can I display the contents of a text file on the command line?".

###Man page: less -F or --quit-if-one-screen

     Causes less to automatically exit if the entire file can be displayed on the first screen.

-X or --no-init

     Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.

Nowadays, is it a good practice to use cat to display or view a file? Why use cat to view a file?

This makes me think to Useless Use Of Cat.

Note: This question is not about the differences between less and more. Moreover, it concerns the visualization of a file created earlier.


According to the answers and comments, it seems that cat is used beyond its use because it is easier to use than a pager (e.g. more, less...). Some people think this is an irrelevant fact (or useless) but experience shows that various subtleties pertaining to the shell may have practical consequences: use a shell loop to process a text file, use unquoted variables...

Negative consequences vary in intensity. For example, cat foo bar | less is valid because the user concatenates two files but cat foo | less is not valid. In the same spirit, cat seems to be required in "a pipeline" although it seems that a pager like less works in a pipeline too (note: less is not suited in all cases concerning displaying, e.g. Reading a named pipe: tail or cat?).

See also: How to cat a file with "or" options

Similar question: How can I display the contents of a text file on the command line?

It seems that the purpose of cat is to concatenate several files. However, many people still use cat instead of less (or a similar program like more) to display a file. See, for example, the GNU m4 manual.

###Man page: less -F or --quit-if-one-screen

     Causes less to automatically exit if the entire file can be displayed on the first screen.

-X or --no-init

     Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.

Nowadays, is it a good practice to use cat to display or view a file? Why use cat to view a file?

This makes me think to Useless Use Of Cat.

Note: This question is not about the differences between less and more. Moreover, it concerns the visualization of a file created earlier.


According to the answers and comments, it seems that cat is used beyond its use because it is easier to use than a pager (e.g. more, less...). Some people think this is an irrelevant fact (or useless) but experience shows that various subtleties pertaining to the shell may have practical consequences: use a shell loop to process a text file, use unquoted variables...

Negative consequences vary in intensity. For example, cat foo bar | less is valid because the user concatenates two files but cat foo | less is not valid. In the same spirit, cat seems to be required in "a pipeline" although it seems that a pager like less works in a pipeline too (note: less is not suited in all cases concerning displaying, e.g. Reading a named pipe: tail or cat?).

See also: How to cat a file with "or" options

Similar question: How can I display the contents of a text file on the command line?

It seems that the purpose of cat is to concatenate several files. However, many people still use cat instead of less (or a similar program like more) to display a file. See, for example, the GNU m4 manual and the answer "How can I display the contents of a text file on the command line?".

###Man page: less -F or --quit-if-one-screen

     Causes less to automatically exit if the entire file can be displayed on the first screen.

-X or --no-init

     Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.

Nowadays, is it a good practice to use cat to display or view a file? Why use cat to view a file?

This makes me think to Useless Use Of Cat.

Note: This question is not about the differences between less and more. Moreover, it concerns the visualization of a file created earlier.


According to the answers and comments, it seems that cat is used beyond its use because it is easier to use than a pager (e.g. more, less...). Some people think this is an irrelevant fact (or useless) but experience shows that various subtleties pertaining to the shell may have practical consequences: use a shell loop to process a text file, use unquoted variables...

Negative consequences vary in intensity. For example, cat foo bar | less is valid because the user concatenates two files but cat foo | less is not valid. In the same spirit, cat seems to be required in "a pipeline" although it seems that a pager like less works in a pipeline too (note: less is not suited in all cases concerning displaying, e.g. Reading a named pipe: tail or cat?).

See also: How to cat a file with "or" options

referred to a similar question
Source Link
user286944
user286944

It seems that the purpose of cat is to concatenate several files. However, many people still use cat instead of less (or a similar program like more) to display a file. See, for example, the GNU m4 manual.

###Man page: less -F or --quit-if-one-screen

     Causes less to automatically exit if the entire file can be displayed on the first screen.

-X or --no-init

     Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.

Nowadays, is it a good practice to use cat to display or view a file? Why use cat to view a file?

This makes me think to Useless Use Of Cat.

Note: This question is not about the differences between less and more. Moreover, it concerns the visualization of a file created earlier.


According to the answers and comments, it seems that cat is used beyond its use because it is easier to use than a pager (e.g. more, less...). Some people think this is an irrelevant fact (or useless) but experience shows that various subtleties pertaining to the shell may have practical consequences: use a shell loop to process a text file, use unquoted variables...

Negative consequences vary in intensity. For example, cat foo bar | less is valid because the user concatenates two files but cat foo | less is not valid. In the same spirit, cat seems to be required in "a pipeline" although it seems that a pager like less works in a pipeline too (note: less is not suited in all cases concerning displaying, e.g. Reading a named pipe: tail or cat?).

See also: How to cat a file with "or" options

Similar question: How can I display the contents of a text file on the command line?

It seems that the purpose of cat is to concatenate several files. However, many people still use cat instead of less (or a similar program like more) to display a file. See, for example, the GNU m4 manual.

###Man page: less -F or --quit-if-one-screen

     Causes less to automatically exit if the entire file can be displayed on the first screen.

-X or --no-init

     Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.

Nowadays, is it a good practice to use cat to display or view a file? Why use cat to view a file?

This makes me think to Useless Use Of Cat.

Note: This question is not about the differences between less and more. Moreover, it concerns the visualization of a file created earlier.


According to the answers and comments, it seems that cat is used beyond its use because it is easier to use than a pager (e.g. more, less...). Some people think this is an irrelevant fact (or useless) but experience shows that various subtleties pertaining to the shell may have practical consequences: use a shell loop to process a text file, use unquoted variables...

Negative consequences vary in intensity. For example, cat foo bar | less is valid because the user concatenates two files but cat foo | less is not valid. In the same spirit, cat seems to be required in "a pipeline" although it seems that a pager like less works in a pipeline too (note: less is not suited in all cases concerning displaying, e.g. Reading a named pipe: tail or cat?).

See also: How to cat a file with "or" options

It seems that the purpose of cat is to concatenate several files. However, many people still use cat instead of less (or a similar program like more) to display a file. See, for example, the GNU m4 manual.

###Man page: less -F or --quit-if-one-screen

     Causes less to automatically exit if the entire file can be displayed on the first screen.

-X or --no-init

     Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.

Nowadays, is it a good practice to use cat to display or view a file? Why use cat to view a file?

This makes me think to Useless Use Of Cat.

Note: This question is not about the differences between less and more. Moreover, it concerns the visualization of a file created earlier.


According to the answers and comments, it seems that cat is used beyond its use because it is easier to use than a pager (e.g. more, less...). Some people think this is an irrelevant fact (or useless) but experience shows that various subtleties pertaining to the shell may have practical consequences: use a shell loop to process a text file, use unquoted variables...

Negative consequences vary in intensity. For example, cat foo bar | less is valid because the user concatenates two files but cat foo | less is not valid. In the same spirit, cat seems to be required in "a pipeline" although it seems that a pager like less works in a pipeline too (note: less is not suited in all cases concerning displaying, e.g. Reading a named pipe: tail or cat?).

See also: How to cat a file with "or" options

Similar question: How can I display the contents of a text file on the command line?

added an hyperlink (reference)
Source Link
user286944
user286944
Loading
added a summary
Source Link
user286944
user286944
Loading
removed backquotes in the question
Link
user286944
user286944
Loading
Post Closed as "Opinion-based" by muru, Prvt_Yadav, Chris Davies, Stephen Harris, Vlastimil Burián
Include GNU m4 example in text (from comments)
Source Link
Kusalananda
  • 356.1k
  • 42
  • 737
  • 1.1k
Loading
Became Hot Network Question
reformulate the sentence so as not to limit the context by reducing the existing characteristics.
Source Link
user286944
user286944
Loading
clarified the question; added precisions.
Source Link
user286944
user286944
Loading
Source Link
user286944
user286944
Loading