CtrlK
BlogDocsLog inGet started
Tessl Logo

cat

Concatenate and display file contents. Use when viewing files, combining files, or creating files from stdin.

64

Quality

76%

Does it follow best practices?

Impact

No eval scenarios have been run

SecuritybySnyk

Passed

No known issues

Optimize this skill with Tessl

npx tessl skill review --optimize ./.flox/pkgs/skill-coreutils/skills/cat/SKILL.md
SKILL.md
Quality
Evals
Security

cat - Concatenate Files

Synopsis

cat [OPTION]... [FILE]...

Concatenate FILE(s) to standard output. With no FILE, or when FILE is -, read standard input.

Flags

FlagLong FormDescription
-n--numberNumber all output lines
-b--number-nonblankNumber nonempty output lines (overrides -n)
-s--squeeze-blankSuppress repeated empty output lines
-E--show-endsDisplay $ at end of each line
-T--show-tabsDisplay TAB characters as ^I
-v--show-nonprintingUse ^ and M- notation for control/meta chars
-A--show-allEquivalent to -vET
-eEquivalent to -vE
-tEquivalent to -vT
--helpDisplay help
--versionOutput version

Examples

# Display file contents
cat file.txt

# Concatenate multiple files
cat file1.txt file2.txt > combined.txt

# Number all lines
cat -n file.txt

# Number non-blank lines
cat -b file.txt

# Squeeze multiple blank lines into one
cat -s file.txt

# Show hidden characters (tabs, line endings)
cat -A file.txt

# Show tabs as ^I
cat -T file.txt

# Create a file from stdin (type content, Ctrl+D to end)
cat > newfile.txt

# Append to a file
cat >> existing.txt

# Concatenate with stdin in between
cat header.txt - footer.txt < body.txt

Gotchas

  • Useless use of cat (UUOC): cat file | command is almost always better written as command < file or command file. Most commands accept files as arguments.
  • cat overwrites the output file if you redirect to the same file:
    # WRONG: destroys file.txt
    cat file.txt | sort > file.txt
    # RIGHT: use a temp file or sponge
    sort file.txt > sorted.txt && mv sorted.txt file.txt
  • For large files, cat loads and outputs everything. Use head, tail, less, or more for partial viewing.
  • cat -v is useful for debugging files with hidden characters like carriage returns (^M) from Windows line endings.
Repository
flox/floxenvs
Last updated
Created

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.