🌐
Linuxize
linuxize.com › home › linux commands › how to use the cat command in linux
How to Use the cat Command in Linux | Linuxize
October 10, 2018 - The cat command is one of the most widely used commands in Linux. The name of the cat command comes from its functionality to concatenate files. It can read, concatenate, and write file contents to the standard output.
🌐
The Knowledge Academy
theknowledgeacademy.com › blog › cat-command-in-linux
Cat Command in Linux: What is it and How to Use it?
In Linux, the Cat Command is an essential tool for managing text files, enabling users to efficiently perform various operations. Similarly, learning how to Rename Files in Linux allows users to manage their file system with ease.
People also ask

How to append the content of one file to another using the Cat Command?
To append the content of one file to another using the Cat Command, use the command "cat file1 >> file2", where "file1" is the source file and "file2" is the destination file.
🌐
theknowledgeacademy.com
theknowledgeacademy.com › blog › cat-command-in-linux
Cat Command in Linux: What is it and How to Use it?
Can the lines be numbered while displaying the content with "cat"?
Yes, lines can be numbered while displaying the content with Cat Command using the "-n" option. Simply use the command "cat -n filename" to display the content of the file with line numbers.
🌐
theknowledgeacademy.com
theknowledgeacademy.com › blog › cat-command-in-linux
Cat Command in Linux: What is it and How to Use it?
What is the Knowledge Pass, and how does it work?
The Knowledge Academy’s Knowledge Pass, a prepaid voucher, adds another layer of flexibility, allowing course bookings over a 12-month period. Join us on a journey where education knows no bounds.
🌐
theknowledgeacademy.com
theknowledgeacademy.com › blog › cat-command-in-linux
Cat Command in Linux: What is it and How to Use it?
Unix utility that concatenates and lists files
Cat-example-command.gif
cat is a shell command for writing the content of a file or input stream to standard output. The name is an abbreviation of catenate, a variant form of concatenate. Originally developed … Wikipedia
Factsheet
cat
Original authors Ken Thompson,
Dennis Ritchie
Factsheet
cat
Original authors Ken Thompson,
Dennis Ritchie
🌐
Wikipedia
en.wikipedia.org › wiki › Cat_(Unix)
cat (Unix) - Wikipedia
1 month ago - cat is a shell command for writing the content of a file or input stream to standard output. The name is an abbreviation of catenate, a variant form of concatenate. Originally developed for Unix, it is available on many operating systems and shells today. In addition to combining files, cat ...
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › cat-command-in-linux-with-examples
Cat Command in Linux - GeeksforGeeks
September 14, 2017 - Linux-Unix · Interview Questions ... 9 Jan, 2026 · The cat (concatenate) command in Linux is used to view, create, and combine file contents directly from the terminal....
Top answer
1 of 4
17

cat's primary purpose is to concatenate files. cat file1 file2 ... will show the contents of file, file2 and the others one after the other, as if the contents were in a single file. See the manpage:

NAME
       cat - concatenate and print files

It is meant for usage where either:

  • a target command cannot read from files and you need to pass multiple files to it. An example is the tr utility. Ordinarily, with one file, you'd do:

    tr < file
    

    But with multiple files, redirection can't be used, so you have to do:

    cat file1 file2 ... | tr
    
  • a target command can read from multiple files, but its behaviour may change when it's given multiple files. An example is wc, which prints the counts for each file, along with the filenames, where you might have wanted just the total, without a filename.

Remember that most commands you encounter (grep, sed, awk, sort, ...) can read files perfectly fine.

If you want to view the contents of a file, use a pager - less and more are both eminently capable of presenting files for viewing, and are far more convenient to use.

2 of 4
14

cat is one of the most frequently used commands on Unix-like operating systems. It has three related functions with regard to text files:

  1. displaying them
  2. combining copies of them
  3. creating new ones.
  4. Copy files

cat's general syntax is:

cat [options] [filenames] [-] [filenames]

Reading Files

The most common use of cat is to read the contents of files, and cat is often the most convenient program for this purpose. All that is necessary to open a text file for viewing on the display monitor is to type the word cat followed by a space and the name of the file and then press the ENTER key. For example, the following will display the contents of a file named file1:

cat file1

Concatenation

The second role of cat is concatenation. (This is the source of cat's curious name.) There is no effect on the original files.

For example, the following command will concatenate copies of the contents of the three files file1, file2 and file3:

cat file1 file2 file3

The contents of each file will be displayed on the monitor screen. This output could just as easily be redirected using the output redirection operator to another file, such as file4, using the following:

cat file1 file2 file3 > file4

File Creation

Thanks to @muru comment : cat is capable of create new files depending on the shell redirection feature and not itself

For small files this is often easier than using vi, gedit or other text editors. It is accomplished by typing cat followed by the output redirection operator and the name of the file to be created, then pressing ENTER and finally simultaneously pressing the Ctrl & d keys.

For example, a new file named file1 can be created by typing

cat > file1

then press ENTER and simultaneously press the Ctrl & d keys.

PS1: If a file named file1 already exists, it will be overwritten

PS2: you can append to exited file using append operator >> example cat >> file1

Copy Files

The cat command can also be used (depending on shell redirection feature) to create a new file and transfer to it the data from an existing file. Example: make a copy of file oldfile.txt:

cat oldfile.txt > newfile.txt

References:

  • Linux and Unix cat command
  • The cat Command
  • cat (Unix)
  • HowTo: Use cat Command In Linux / UNIX
🌐
Server Academy
serveracademy.com › blog › the-linux-cat-command
The Linux cat Command - Server Academy
Introduction to the cat Command The cat command in Linux is one of the most frequently used commands in Unix-like operating systems. It stands for “concatenate” and is primarily used to read, display, and concatenate text files.
🌐
TutorialsPoint
tutorialspoint.com › home › unix_commands › cat command in unix
Cat Command in Unix
October 13, 2007 - Learn how to use the cat command in Unix to display, concatenate, and create text files efficiently. Explore examples and syntax.
Find elsewhere
🌐
Computer Hope
computerhope.com › unix › ucat.htm
Linux Cat Command
On Unix-like operating systems, the cat command reads data from files, and outputs their contents. It is the simplest way to display the contents of a file at the command line. This page covers the GNU/Linux version of cat.
🌐
nixCraft
cyberciti.biz › nixcraft › howto › linux › cat command in linux / unix with examples
cat Command in Linux / Unix with examples - nixCraft
December 2, 2025 - See cat command man page by typing the man command: $ man cat $ cat --help · 🥺 Was this helpful? Please add a comment to show your appreciation or feedback. Vivek Gite is an expert IT Consultant with over 25 years of experience, specializing in Linux and open source solutions. He writes about Linux, macOS, Unix, IT, programming, infosec, and open source.
🌐
Linux Man Pages
man7.org › linux › man-pages › man1 › cat.1.html
cat(1) - Linux manual page
-A, --show-all equivalent to -vET -b, --number-nonblank number nonempty output lines, overrides -n -e equivalent to -vE -E, --show-ends display $ at end of each line -n, --number number all output lines -s, --squeeze-blank suppress repeated empty output lines -t equivalent to -vT -T, --show-tabs display TAB characters as ^I -u (ignored) -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB --help display this help and exit --version output version information and exit · cat f - g Output f's contents, then standard input, then g's contents.
🌐
Vultr
docs.vultr.com › how-to-use-the-cat-command-in-linux
How to Use the Cat Command in Linux: Complete Guide | Vultr Docs
May 21, 2025 - The cat command, short for "concatenate," is one of the most fundamental utilities in Unix-like operating systems. First introduced in Version 1 Unix (1971), it comes pre-installed on nearly all Linux distributions.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › linux cat command (with examples)
Linux cat Command (With Examples) | phoenixNAP KB
September 4, 2025 - Use the cat command to create new files and add content to them. Create test1.txt and test2.txt files to use as sample files and test other command examples. ... This is test file #1. 3. To exit the prompt and write the changes to the file, ...
🌐
TechOnTheNet
techonthenet.com › unix › basic › cat.php
UNIX Basic commands: cat
The cat command reads one or more files and prints them to standard output. The operator > can be used to combine multiple files into one. The operator >> can be used to append to an existing file.
🌐
Unix Tutorial
unixtutorial.org › commands › cat
cat – concatenate files and print to standard output | Unix Tutorial
cat concatenates files and prints them to standard output. It’s the go-to tool for viewing small text files. Synopsis cat [OPTIONS] [FILE].
🌐
Software Testing Help
softwaretestinghelp.com › home › unix linux › unix cat command syntax, options with examples
Unix Cat Command Syntax, Options with Examples
April 1, 2025 - In this example, the command reads its input from the terminal, and writes the output to the file “file1”. The user can enter their text line by line and terminate the input with the “^D” character that indicates end-of-file. The cat command also supports the following options: ... Thanks for your feedback! Unix Sort Command with Syntax, Options and Examples
🌐
W3Schools
w3schools.com › bash › bash_cat.php
Bash cat Command - Concatenate and Display Files
This command takes the contents of file1.txt and file2.txt and writes them into combined.txt. The cat command is often used with piping to send the content of files to other commands.
🌐
nixCraft
cyberciti.biz › nixcraft › howto › linux › how to use cat command in linux / unix
How To Use cat Command In Linux / UNIX - nixCraft
February 15, 2025 - For example, $ cat /proc/cpuinfo | grep model Can be used as follows: $ grep model /proc/cpuinfo Another example, $ cat filename | sed -e 'commands' -e 'commands2' Can be used as follows which is cheaper: $ sed -e 'commands' -e 'commands2' filename See useless use of cat command for more information. 🥺 Was this helpful? Please add a comment to show your appreciation or feedback. Vivek Gite is an expert IT Consultant with over 25 years of experience, specializing in Linux and open source solutions. He writes about Linux, macOS, Unix, IT, programming, infosec, and open source.
🌐
LinuxTeck
linuxteck.com › basic-cat-command-in-linux-with-examples
12 Basic Cat Command In Linux With Examples | LinuxTeck
December 28, 2025 - By using the cat command, we can see the contents of a file on screen. Cat concatenates FILE(s) or standard input, to a preferred output. With no FILE, or when FILE is -, it reads trendy input.
🌐
Hostman
hostman.com › tutorials › how to use the linux cat command: tutorial and examples
How to Use the Linux Cat Command | Hostman
December 26, 2025 - The basic purpose of the cat command is to join files together and show their contents on the terminal. Its usefulness goes far beyond simple concatenation, though. With its many functions, it's a useful addition to any Linux user's command-line ...
Price   $
Address   1999 Harrison St 1800 9079, 94612, Oakland
🌐
LINFO
linfo.org › cat.html
The cat Command
cat is one of the most frequently used commands on Unix-like operating systems. It has three related functions with regard to text files: displaying them, combining copies of them and creating new ones · cat's general syntax is