Shell Listing in Detail
A listing in detail shows more than names. ls -l shows size, date, and owner for each file.
Long listing
ls -l shows a long listing for one file.
ls -l notes.txtA whole folder
ls -l shows a long listing for a folder too.
ls -l docsHidden files
ls -a shows files that start with a dot. The dots are the folder itself and its parent.
ls -a docsReadable sizes
ls -h shows sizes in a readable form. Small files still show plain numbers.
ls -lh notes.txtExample
ls -l notes.txt
ls -a docs
ls -lh report.txtKey points
- Flag: an option that starts with a dash, like -l.
- Use ls -l to show a long listing.
- Use ls -a to show hidden files too.
- Use ls -h to show sizes in a readable form.
- Permissions say who is allowed to read, write and run a file.
- Owner: the user the file belongs to.
- The long listing shows permissions, owner, size, date, and name.
In this example, the first line gives a long listing for notes.txt. The second line shows hidden files in docs. The last line shows a long listing with readable sizes for report.txt.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
Which flag shows a long listing?