Examples of Bash Cat Command
Here you will find out:
- what is cat command
- examples of cat command
- when DiskInternals can help you
Are you ready? Let's read!
Cat command in Linux
Cat, which is short for concatenate, is one of the most commonly used commands in Linux and other Unix-like operating systems.
The cat command allows us to create single or multiple files, view file inclusions, concatenate files and redirect output in a terminal or file.
In this article, we will show you some handy uses of the cat command and examples of it in Linux.
Concatenation:
Cat has three related functions related to text files: displaying them, merging their copies, and creating new files.
The general syntax of a cat command is:
Square brackets indicate that the accompanying items are optional.
Examples:
Here are 10 Bash cat commands and cat shell commands for you to practice:
- 1. How to view a single file:
This command will show you the contents of the file name.
- 2. How to use the cat command to view multiple files:
This command will show you the content of file1 and file2.
- 3. How to view the file's contents starting with the line number
- 4. How to create a file with cat command in Linux
- 5. How to copy the content of the one file to another
- 6. How to suppress repeated blank lines in the output
- 7. How to append the contents of one file to the end of another file
- 8. How to use the tac command to display content in reverse order
- 9. How to highlight the end of a line
- 10. In case if you want to use the -v, -E and -T options at the same time, you can use only the -A command-line option instead of writing -vET in the command
Linux Reader as an explorer to access Linux files on Windows
If you’re reading this article about the Unix cat command, there is a lot more that you might need to do on your computer.
If you want to easily mount or read Linux files on your Windows operating system, DiskInternals Linux Reader will help you do just that.
With its easy-to-use UI and powerful design, you can easily mount or read your Linux filesystems on Windows.