Recall & Review
beginner
What does the
cat command do in Linux?The
cat command reads and displays the contents of a file on the screen. It can also combine multiple files into one output.Click to reveal answer
beginner
How do you display the contents of a file named
notes.txt using cat?You type
cat notes.txt in the terminal. This shows the full content of notes.txt on the screen.Click to reveal answer
beginner
What happens if you use
cat with multiple files like cat file1.txt file2.txt?The contents of
file1.txt and file2.txt are shown one after the other, combined in the output.Click to reveal answer
intermediate
How can you create a new file using
cat?You can type
cat > newfile.txt, then type your text. Press Ctrl+D to save and exit. This creates newfile.txt with your text.Click to reveal answer
intermediate
What is a simple way to number the lines of a file when displaying it with
cat?Use
cat -n filename. This shows the file content with line numbers before each line.Click to reveal answer
What does the command
cat file.txt do?✗ Incorrect
cat file.txt shows the content of the file on the screen.
How do you combine two files
a.txt and b.txt into one output using cat?✗ Incorrect
cat a.txt b.txt outputs the contents of both files one after the other.
Which key combination do you press to finish typing text when creating a file with
cat > file.txt?✗ Incorrect
Pressing Ctrl+D signals the end of input and saves the file.
What does
cat -n file.txt do?✗ Incorrect
The -n option numbers each line of the file in the output.
If you want to quickly view a file's content, which command is best?
✗ Incorrect
cat filename shows the file content. The others do different tasks.
Explain how to use
cat to display a file and how to combine multiple files into one output.Think about how you read one book page and then two books back to back.
You got /3 concepts.
Describe the steps to create a new text file using
cat and how to save it.Imagine writing a note and then closing the notebook to save it.
You got /3 concepts.