tldr/pages/common/ls.md

35 lines
491 B
Markdown
Raw Normal View History

2014-01-28 09:27:02 +00:00
# ls
> List directory contents
- List all files, even hidden
`ls -a`
2014-03-02 07:30:07 +00:00
- List all file names (no extra info)
2014-01-28 09:27:02 +00:00
2014-03-02 07:30:07 +00:00
`ls -A1`
2014-01-28 09:27:02 +00:00
- List all files with their rights, groups, owner
`ls -ls`
2014-01-28 21:58:16 +00:00
- List all files and display the file size in a human readable format
`ls -lh`
2014-01-28 21:58:16 +00:00
- List all files with a prefix/suffix
`ls {{prefix}}*`
`ls *{{suffix}}`
2014-01-28 21:58:16 +00:00
2014-03-02 07:30:07 +00:00
- Sort the results size
2014-01-28 21:58:16 +00:00
2014-03-02 07:30:07 +00:00
`ls -s # by size`
`ls -t # by last modified date`
`ls -U # by creation date`
2014-02-21 22:05:52 +00:00
2014-03-02 07:30:07 +00:00
- Reverse the order of the results
2014-02-21 22:05:52 +00:00
2014-03-02 07:30:07 +00:00
`ls -r`