cat

February 12, 2024

Example Commands

  • Display file content: cat filename.txt
  • Create a file: cat > filename.txt
  • Concatenate multiple files: cat file1.txt file2.txt > mergedfile.txt
  • Append file content: cat additional.txt >> existingfile.txt
  • Number lines: cat -n file.txt

Other Useful Options

  • -n: Numbers all output lines, which is useful for viewing or debugging files with content that needs to be referenced by line number.
  • -s: Suppresses repeated empty output lines, condensing the output to make it easier to read.
  • -E: Displays a $ at the end of each line, making it easier to see line breaks, especially in files with mixed content or trailing spaces.