What does `cat` do?

The cat command in Unix/Linux is used to concatenate and display the contents of files. It can read one or more files and output their content to the standard output (usually the terminal). Here are some common uses of cat:

  1. Display a file's content:

    cat filename.txt
  2. Concatenate multiple files:

    cat file1.txt file2.txt > combined.txt
  3. Create a new file:

    cat > newfile.txt

    (You can then type text and press CTRL+D to save.)

  4. View content with line numbers:

    cat -n filename.txt

Overall, cat is a versatile command for file manipulation and viewing in the command line.

0 Comments

no data
Be the first to share your comment!