How to view a file’s contents
Overview
type prints one or more text files. more displays long text a screen at a time.
These commands do not edit the file. Binary files such as images or programs produce unreadable output and may make the console look odd.
- Press Space for the next page in
more, Enter for the next line, or Q to quit. - Wildcards such as
type *.txtconcatenate matching files. - Notepad is useful when wrapping, searching, or encoding matters.
Commands to try
Type each command at the prompt, then press Enter. Replace sample names and paths with ones that exist on your computer.
Commands are generally not case-sensitive, but preserving the spelling shown here makes scripts easier to read.
type notes.txt
type first.txt second.txt
more < long-report.txt
type long-report.txt | more
notepad notes.txt
Useful options and details
Options change how a command behaves. Add spaces exactly as shown, and use the command's built-in help when an option is unfamiliar.
A path containing spaces must be enclosed in double quotes, such as "C:\My Files".
typeaccepts paths and multiple filenames.more < filereads a file through input redirection.command | morecan page any command's text output.
Tips and common mistakes
Check the current folder and read the command output before assuming an operation succeeded.
Practice with disposable files first. Commands that delete, overwrite, or stop a process may not offer an Undo button.
- Do not run
typeon very large or binary files. - If characters look wrong, the file's encoding may not match the console.
- A filename with spaces needs quotes.
Safe practice
Create a temporary practice folder under your user profile so the examples cannot affect Windows system files.
After each command, inspect the result with dir or another read-only command before continuing.
- View the file from the create-file lesson.
- Make enough lines to test
more. - Quit paging before reaching the end.