diff --git a/README.md b/README.md index 0cf9ff5..dfc66d1 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1402 TILs and counting..._ +_1403 TILs and counting..._ --- @@ -1377,6 +1377,7 @@ _1402 TILs and counting..._ - [Less With Style](unix/less-with-style.md) - [List All The Enabled ZSH Options](unix/list-all-the-enabled-zsh-options.md) - [List All Users](unix/list-all-users.md) +- [List Files In A Single Column](unix/list-files-in-a-single-column.md) - [List Files Ordered By Modification Date](unix/list-files-ordered-by-modification-date.md) - [List Names Of Files With Matches](unix/list-names-of-files-with-matches.md) - [List Of Sessions To A Machine](unix/list-of-sessions-to-a-machine.md) diff --git a/unix/list-files-in-a-single-column.md b/unix/list-files-in-a-single-column.md new file mode 100644 index 0000000..c4b98c5 --- /dev/null +++ b/unix/list-files-in-a-single-column.md @@ -0,0 +1,34 @@ +# List Files In A Single Column + +The `ls` command lists out the files and directories in your current directory +or a specified directory. + +The standard output for an `ls` command expands the fit the width of your +terminal screen. + +```bash +❯ ls *.(ts|js) +cypress.config.ts postcss.config.js remix.config.js remix.env.d.ts server.ts tailwind.config.ts vitest.config.ts +``` + +This might not always be the ideal way to view that output. For instance, the +above example when shared as a code block like in this post ends up with +horizontal scroll. + +With the `-1` flag, we can tell `ls` to display the results in a single +vertical column. + +```bash +❯ ls -1 *.(ts|js) +cypress.config.ts +postcss.config.js +remix.config.js +remix.env.d.ts +server.ts +tailwind.config.ts +vitest.config.ts +``` + +See `man ls` for more details. + +[source](https://askubuntu.com/questions/954924/listing-files-in-directory-in-one-column)