The cat
command in Linux/Unix is a command-line utility that is used to concatenate and display the contents of one or more files. It stands for “concatenate.”
Some common uses of cat
include:
- Displaying the contents of a file:
cat file.txt
- Concatenating the contents of multiple files into a single file:
cat file1.txt file2.txt > combined_file.txt
- Displaying the contents of multiple files:
cat file1.txt file2.txt
- Creating a new file and adding contents to it:
cat > new_file.txt
- Displaying the contents of a file, page by page:
cat file.txt | less
- Displaying the contents of a file in reverse order:
tac file.txt
These are just a few examples of the ways that the cat
command can be used. It’s a simple but powerful tool that can be used in many different ways to manipulate and display the contents of files.