Where to start First steps track · 15 stages
Linux Labs

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/hostname print a file
  • cat -n app.conf with line numbers
  • cat a.txt b.txt two files one after another
  • cat a.txt b.txt > all.txt join them into a new file
  • cat -A file show tabs (^I), line ends ($), \r (^M)
  • cat -s file squeeze repeated blank lines
  • tac file lines in reverse order
  • sudo cat /etc/shadow a file only root can read

Options

cat has few options, and they all change how output looks. Full list — man cat.

Loading…