docs: add articles
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# catコマンド
|
||||
|
||||
`cat`(concatenate)は、ファイルや標準入力から読み込んだデータを標準出力に書き出すコマンド
|
||||
|
||||
## 使用例
|
||||
|
||||
### 最も基本的な使い方
|
||||
|
||||
```
|
||||
cat test.txt
|
||||
```
|
||||
|
||||
### 複数ファイルの内容を標準出力に書き出す
|
||||
|
||||
```
|
||||
cat file1.txt file2.txt
|
||||
```
|
||||
|
||||
### 標準入力からデータを読み込む
|
||||
標準入力をキーボードから読み込む:
|
||||
```
|
||||
tsubanyan@localhost:~$ cat
|
||||
hello
|
||||
hello
|
||||
world
|
||||
world
|
||||
tsubanyan@localhost:~$
|
||||
```
|
||||
- ファイルを指定せずに実行すると、標準入力からデータを読み込む
|
||||
- 端末は通常カノニカルモードなので、改行文字が入力され初めて`cat`に渡る
|
||||
|
||||
標準入力をファイルから読み込む:
|
||||
```
|
||||
cat < test.txt
|
||||
```
|
||||
- `<` ... 指定したファイルをコマンドの標準入力に接続するリダイレクト演算子
|
||||
- `cat`は標準入力から`test.txt`の内容を読み込み、標準出力に書き出す
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user