Forrest logo
back to the cat tool

cat:tldr:346b1

cat: [n]umber all output lines.
$ cat -n ${filename}
try on your machine

The command cat -n ${filename} is used to display the contents of a file with line numbers.

Here's a breakdown of the command:

  • cat: It is a command in Unix-like operating systems that is used to concatenate and display the contents of files.
  • -n: It is an option that adds line numbers to the output. Each line will be prefixed with its line number.
  • ${filename}: This is a placeholder for the actual name of the file you want to display. You need to replace ${filename} with the actual name or path of the file you want to view.

Combining these components, the command cat -n ${filename} will display the contents of the specified file with line numbers.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the cat tool