Concept Flow - cat (display file contents)
Start
Run 'cat filename'
Shell reads file
File contents sent to stdout
Display contents on screen
End
The 'cat' command reads a file and shows its contents on the screen step-by-step.
cat example.txt
| Step | Action | Input | Output | Notes |
|---|---|---|---|---|
| 1 | Run command | cat example.txt | None | Command starts |
| 2 | Shell opens file | example.txt | File data stream | Reads file contents |
| 3 | Send data to stdout | File data stream | Text lines | Data flows to screen |
| 4 | Display output | Text lines | Visible file contents | User sees file text |
| 5 | End | None | None | Command finishes |
| Variable | Start | After Step 2 | After Step 3 | Final |
|---|---|---|---|---|
| file_data | None | File contents loaded | Sent to stdout | Displayed on screen |
cat filename - Reads the whole file named 'filename' - Sends contents to screen (stdout) - Shows file text exactly as is - If file missing, shows error - Useful to quickly view file contents