Files
freeCodeCamp/guide/english/bash/bash-cat/index.md
Máté Szőnyi 8e4b2795ab Add a "tip" section to the article (#29865)
* Add a "tip" section to the article

With 1 tip for a frequent error I got when I started using bash

* Fixed formatting issues
2018-11-05 02:01:23 -05:00

942 B

title
title
Bash Cat

Bash Cat

cat is one of the most frequently used commands in Unix operating systems.

cat is used to read a file sequentially and print it to the standard output. The name is derived from its function to concatenate files.

Usage

cat [options] [file_names]

Most used options:

  • -b, number non-blank output lines
  • -n, number all output lines
  • -s, squeeze multiple adjacent blank lines
  • -v, display non-printing characters, except for tabs and the end of line character

Example

Print in terminal the content of file.txt:

cat file.txt

Concatenate the content of the two files and display the result in terminal:

cat file1.txt file2.txt

Tip: Using cat on a directory will cause error, so make sure it's a readable file.

More Information: