␡
- List Files and Folders
- List the Contents of Other Folders
- List Folder Contents Using Wildcards
- View a List of Files in Subfolders
- View a List of Contents in a Single Column
- View Contents As a Comma-Separated List
- View Hidden Files and Folders
- Visually Display a File's Type
- Display Contents in Color
- List Permissions, Ownership, and More
- Reverse the Order Contents Are Listed
- Sort Contents by Date and Time
- Sort Contents by Size
- Express File Sizes in Terms of K, M, and G
- Display the Path of Your Current Directory
- Change to a Different Directory
- Change to Your Home Directory
- Change to Your Previous Directory
- Conclusion
This chapter is from the book
View Contents As a Comma-Separated List
ls -m
Another option for those who can’t stand columns of any form, whether it’s one or many, is the -m option (or --format=commas).
$ ls -m ~/ alias, bin, Desktop, documents, iso, music, pictures, podcasts, program_files, src, todo, videos
Think of the m in -m as a mnemonic for comma, and it is easier to remember the option. Of course, this option is also useful if you’re writing a script and need the contents of a directory in a comma-separated list, but that’s a more advanced use of a valuable option.