terminal.cab

All commands

cat

Topic: Files and folders

Program: cat

Shows the contents of files.

Package: core-nav

Usage

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

Description

Print the contents of each FILE, one after the other. A FILE named -, or no FILE at all, means the keyboard or pipe.

Options in the simulator

10 more options of the real program, not in the simulator yet
  • -A, --show-all not in the simulator yet

    Explanation to come

  • -b, --number-nonblank not in the simulator yet

    Explanation to come

  • -e not in the simulator yet

    Explanation to come

  • -E, --show-ends not in the simulator yet

    Explanation to come

  • -s, --squeeze-blank not in the simulator yet

    Explanation to come

  • -t not in the simulator yet

    Explanation to come

  • -T, --show-tabs not in the simulator yet

    Explanation to come

  • -u not in the simulator yet

    Explanation to come

  • -v, --show-nonprinting not in the simulator yet

    Explanation to come

  • --version not in the simulator yet

    On a real system it prints the version of the program.

Examples

From the lesson Paths: absolute, relative, ~ and ..
cat "Documents/Holiday 2027.txt"
Where: the coast
When: July
Budget: 1200

Try it in the terminal

From the lesson Looking into files: cat, less, head and tail
cat notes.txt
Buy milk
Call the dentist
Water the plants

Try it in the terminal

From the lesson Faster
cat Documents/Holiday\ 2027.txt
Where: the coast
When: July
Budget: 1200

Try it in the terminal

From the lesson Chaining commands
cat notes.txt missing.txt
Buy milk
Call the dentist
Water the plants
cat: missing.txt: No such file or directory
cat notes.txt missing.txt 2>/dev/null
Buy milk
Call the dentist
Water the plants

Try it in the terminal

From the lesson Reading logs without drowning
cat /etc/hostname
web-01
cat /etc/app/app.conf
# web-01
port = 8080
workers = 2
log_level = info
log_dir = /var/log/app

Try it in the terminal

From the lesson Reading memory
cat /proc/meminfo
MemTotal:       15728640 kB
MemFree:          943718 kB
MemAvailable:    8703181 kB
Buffers:          307200 kB
Cached:          8500000 kB
SwapCached:            0 kB
Active:                0 kB
Inactive:              0 kB
Active(anon):          0 kB
Inactive(anon):        0 kB
Active(file):          0 kB
Inactive(file):        0 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       2097152 kB
SwapFree:        1887436 kB
Zswap:                 0 kB
Zswapped:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:             0 kB
Mapped:                0 kB
Shmem:             51200 kB
KReclaimable:          0 kB
Slab:                  0 kB
SReclaimable:          0 kB
SUnreclaim:            0 kB
KernelStack:           0 kB
PageTables:            0 kB
SecPageTables:         0 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:           0 kB
Committed_AS:          0 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
Percpu:                0 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
Unaccepted:            0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:           0 kB
DirectMap2M:           0 kB
DirectMap1G:           0 kB

Try it in the terminal

From the command of the day: cat -n
cat -n todo.txt
     1  1. tidy up Downloads
     2  2. read the log

Try it in the terminal

Where you learn it

Lessons

Command of the day

All commands