Added two more options '-lh' and '-lS' (#21172)

This commit is contained in:
Taweewat Somboonpanyakul
2018-12-08 21:32:36 -05:00
committed by Paul Gamble
parent 5dc7c2b24d
commit 5f1a596cc1

View File

@ -1,44 +1,46 @@
--- ---
title: Bash ls title: Bash ls
--- ---
## Bash ls ## Bash ls
`ls` is a command on Unix-like operating systems to list contents of a directory, for example folder and file names. `ls` is a command on Unix-like operating systems to list contents of a directory, for example folder and file names.
### Usage ### Usage
```bash ```bash
ls [options] [file_names] ls [options] [file_names]
``` ```
You can list the items in any directory without even entering the directory. Consider you are in a directory with folders- Test1,Test2. You're in the parent directory you can list all files in Test1 as follows- You can list the items in any directory without even entering the directory. Consider you are in a directory with folders- Test1,Test2. You're in the parent directory you can list all files in Test1 as follows-
`ls Test1` `ls Test1`
Most used options: Most used options:
* `-a`, all files and folders, including ones that are hidden and start with a `.` * `-a`, all files and folders, including ones that are hidden and start with a `.`
* `-l`, List in long format * `-l`, List in long format
* `-G`, enable colorized output. * `-lh`, Shows sizes in human readable format
* `-s`, List File Size. * `-lS`, Displays file size in order, will display big in size first
* `-t`, Sorts the output by modification time * `-G`, enable colorized output.
* `-r`, Reverses the order while sorting * `-s`, List File Size.
* `-R`, displays the contents of the directory, and its subdirectories. * `-t`, Sorts the output by modification time
* `-r`, Reverses the order while sorting
### Example: * `-R`, displays the contents of the directory, and its subdirectories.
List files in `freeCodeCamp/guide/` ### Example:
```bash List files in `freeCodeCamp/guide/`
ls ⚬ master
CODE_OF_CONDUCT.md bin package.json utils ```bash
CONTRIBUTING.md gatsby-browser.js plugins yarn.lock ls ⚬ master
LICENSE.md gatsby-config.js src CODE_OF_CONDUCT.md bin package.json utils
README.md gatsby-node.js static CONTRIBUTING.md gatsby-browser.js plugins yarn.lock
assets gatsby-ssr.js translations LICENSE.md gatsby-config.js src
``` README.md gatsby-node.js static
assets gatsby-ssr.js translations
#### More Information: ```
* [Wikipedia](https://en.wikipedia.org/wiki/Ls) #### More Information:
* [Shapeshed](https://shapeshed.com/unix-ls/)
* [Wikipedia](https://en.wikipedia.org/wiki/Ls)
* [Shapeshed](https://shapeshed.com/unix-ls/)