18
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Linux][ls] lsでファイルごとに改行して表示 (ls -1)

Last updated at Posted at 2016-12-16

いままでsed/awkとかで頑張っていたけれども、実はそんなことをしなくてもよかった。

-1 オプションでファイルごとに1行で表示ができる。

ls_helpより-1オプション
 -1                         list one file per line

使用例

-1 オプションの使用例、ついでに -v オプションで辞書順ではなくバージョン順(自然順)ソートにできる。

使用例
$ touch file{0..10}

$ ls
file0  file1  file10  file2  file3  file4  file5  file6  file7  file8  file9

$ ls -1
file0
file1
file10
file2
file3
file4
file5
file6
file7
file8
file9

$ ls -1 -v
file0
file1
file2
file3
file4
file5
file6
file7
file8
file9
file10
18
7
3

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
18
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?