Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

NAME

cat - concatenate files and print on the standard output

SYNOPSIS

cat [OPTION] [FILE...]

DESCRIPTION

Concatenate FILE(s) and print on the standard output. If FILE is not specified, cat reads its input from the standard input.

OPTIONS

-n

Number all output lines.

EXAMPLES

To display the contents of a file

Code Block
cat foo.sql

To number all output lines, use:

Code Block
cat -n foo.sql

To concatenate multiple files and display to the console, use the below command. The contents of the files are not modified or altered.

Code Block
cat foo1.sql foo2.sql

To concatenate multiple files to a file, use the below command. The contents of the files are not modified or altered

Code Block
cat foo1.sql foo2.sql >output.sql

To copy a file using cat command

Code Block
cat foo1.sql >newfile.sql


To use cat command for file creation use the below command. Enter the contents and use Ctrl+C

Code Block
cat > foo1.sql