Updated some new usages (#31635)
* Updated some new usages Displaying information using wild card and merging file usuage added * fix: resolve-conflicts
This commit is contained in:
@ -3,27 +3,23 @@ title: Bash cat
|
|||||||
---
|
---
|
||||||
|
|
||||||
## Bash command: cat
|
## Bash command: cat
|
||||||
|
|
||||||
The bash command `cat` is one of the most frequently used commands in Unix operating systems. It is used to read a file sequentially and print it to the standard output.
|
The bash command `cat` is one of the most frequently used commands in Unix operating systems. It is used to read a file sequentially and print it to the standard output.
|
||||||
The command's name is derived from its function to con**cat**enate files.
|
The command's name is derived from its function to con**cat**enate files.
|
||||||
|
|
||||||
The cat command can also be used to create a text file.
|
The cat command can also be used to create a text file.
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cat [options] [file_names]
|
cat [options] [file_names]
|
||||||
```
|
```
|
||||||
|
|
||||||
Most used options:
|
Most used options:
|
||||||
|
|
||||||
* `-b`, number non-blank output lines
|
* `-b`, number non-blank output lines
|
||||||
* `-n`, number all output lines
|
* `-n`, number all output lines
|
||||||
* `-s`, squeeze multiple adjacent blank lines
|
* `-s`, squeeze multiple adjacent blank lines
|
||||||
* `-v`, display nonprinting characters, except for tabs and the end of line character
|
* `-v`, display nonprinting characters, except for tabs and the end of line character
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
Print in terminal the content of file.txt:
|
Print in terminal the content of file.txt:
|
||||||
```bash
|
```bash
|
||||||
cat file.txt
|
cat file.txt
|
||||||
@ -45,6 +41,11 @@ cat > yourfile.txt
|
|||||||
```
|
```
|
||||||
After pressing Enter, the cursor will be placed on the next line. You can start entering your desired text directly into your file. Press Ctrl+D or Ctrl+C to exit the file.
|
After pressing Enter, the cursor will be placed on the next line. You can start entering your desired text directly into your file. Press Ctrl+D or Ctrl+C to exit the file.
|
||||||
|
|
||||||
|
Using wildcard to display contents of all text files:
|
||||||
|
```bash
|
||||||
|
cat *.txt
|
||||||
|
```
|
||||||
|
|
||||||
**Tip**: Using `cat` on a directory will cause error, so make sure it's a readable file.
|
**Tip**: Using `cat` on a directory will cause error, so make sure it's a readable file.
|
||||||
|
|
||||||
#### More Information:
|
#### More Information:
|
||||||
|
Reference in New Issue
Block a user