cat — print a whole file
cheat sheet · Ubuntu 24.04 · GNU coreutils 9.4 https://lab.dimsanych.ru/en/wiki/cat/Cheat sheet
-
cat /etc/hostnameprint a file -
cat -n app.confwith line numbers -
cat a.txt b.txttwo files one after another -
cat a.txt b.txt > all.txtjoin them into a new file -
cat -A fileshow tabs (^I), line ends ($), \r (^M) -
cat -s filesqueeze repeated blank lines -
tac filelines in reverse order -
sudo cat /etc/shadowa file only root can read
Options
cat has few options, and they all change how output looks. Full list — man cat.