Cat(concatenate) command reads data from the file and gives their content as output.
Here are some of the use cases of the command :
$ cat >newfile
Creates a new file called newfile
You may have run into this while checking your os type.
$ cat /etc/os-release
On my Os this outputs:
PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"
$cat [filename-whose-contents-is-to-be-copied] > [destination-filename]
$ cat file1 file2
Outputs contents in file1 and file2 .
$cat file1 >> file2
Will append contents of file1 to file 2
$cat -- "-dashfile"
Will display the content of -dashfile
$cat "filename" | more
$cat "filename1" "filename2" "filename3" > "merged_filename"
Will merge the contents of file in respective order and will insert that content in "merged_filename".
Will show the content of all html files present in the folder.
$cat >> geeks.txt The newly added text.
Will append the text "The newly added text." to the end of the file.