LoginSignup
1
1

More than 5 years have passed since last update.

GNU lsをファイル出力するときは標準出力と見た目が違うから気をつける

Posted at

標準出力

$ ls
Plugin      Vendor      app     composer.json   composer.lock   composer.phar   fabfile.py  fabfile.pyc

端末上では横に並ぶ。

ファイル

tee

$ ls | tee ~/test.txt 
Plugin
Vendor
app
composer.json
composer.lock
composer.phar
fabfile.py
fabfile.pyc

出力した後cat

$ ls > ~/test.txt && cat ~/test.txt 
Plugin
Vendor
app
composer.json
composer.lock
composer.phar
fabfile.py
fabfile.pyc

標準出力も1行1ファイルにしてみる

$ ls -1
Plugin
Vendor
app
composer.json
composer.lock
composer.phar
fabfile.py
fabfile.pyc
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1