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:
-
Display a file's content:
cat filename.txt -
Concatenate multiple files:
cat file1.txt file2.txt > combined.txt -
Create a new file:
cat > newfile.txt(You can then type text and press
CTRL+Dto save.) -
View content with line numbers:
cat -n filename.txt
Overall, cat is a versatile command for file manipulation and viewing in the command line.
