Linux cat command

|

What is the cat Command?

When you use cat command, it shows the content of a file directly in the terminal. It can also create a new file. It can join the content of two or more files together into a single file.

Syntax:

cat [option] filename

Example 1: Display the content of a file


Command:

cat file.txt

Output:

It shows the content of file.txt on the terminal screen.

Example 2: Create a new file


Command:

cat > newfile.txt

Output:

It creates a new empty file named newfile.txt.
(You can type text inside it, and then save with Ctrl+D.)

Example 3: Join the content of files


Command:

cat file1.txt file2.txt > combined.txt

Output:

It merges the content of file1.txt and file2.txt into a new file named combined.txt.

ONLINE WEB TOOLS

WhatIsMyIpAddress
Shorterner