cat <file>Prints a file to the terminal. /etc/os-release is a quick way to identify the distribution.
Example
cat /etc/os-releaseConcatenates files and prints them to standard output — view, combine and create files.
sudo apt install coreutilscat <file>Prints a file to the terminal. /etc/os-release is a quick way to identify the distribution.
Example
cat /etc/os-releasecat -n <file>Numbers every output line.
Example
cat -n script.shcat -b <file>Numbers only non-blank lines.
Example
cat -b config.inicat -A <file>Reveals hidden characters: tabs as ^I, line ends as $ — great for spotting Windows line endings (^M$).
Example
cat -A data.csvcat -s <file>Squeezes repeated blank lines into one.
Example
cat -s notes.txtcat <file1> <file2> > <out>Concatenates files into a new file.
Example
cat part1.txt part2.txt > full.txtcat <file> >> <out>Appends a file to the end of another.
Example
cat new-hosts.txt >> targets.txtcat > <file> << 'EOF'Writes multiple lines into a file using a here-document; quoting EOF stops variable expansion.
Example
cat > hello.sh << 'EOF'
#!/bin/sh
echo hello
EOFcat -Reads from standard input until Ctrl-D — a quick way to paste text.
cat /etc/passwdLists local accounts, their UID/GID, home directory and login shell.
cat /proc/versionShows the kernel version and the compiler used to build it.
cat /etc/hostsShows static hostname mappings, which can reveal internal hosts.
cat ~/.bash_historyReads the shell history — often contains typed passwords, hostnames and paths.