ls command in Linux with Examples

ls command mean List the names of files. In this tutorial, How to use the ls command in Linux with Examples.

ls command in Linux with Examples

Syntax

ls [OPTION]… [FILE]…

On the man page, the describes it

  • ls – list directory contents.
  • man ls – More details information about ls command.

ls command in Linux with Examples

$ ls -l
$ ls -a
$ ls

How to display file timestamps use the option ‘–time-style’

ls -l --time-style="+%Y-%m-%d %H:%M:%S" /home/vagrant
ls command in Linux with Examples

List only directory with option ‘-ld’

ls -ld /home/vagrant
List only directory with option '-ld'

List file recursively

ls -lR /home/vagrant/kubekey
List file recursively

List files with size.

ls -s /home/vagrant/
List files with size.

Conclusion

ls command is a simple command in Linux. It is the most popular in use terminal Linux list directory contents. Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.