What does the `ls` command do?

QuestionsQuestions8 SkillsProBasic Files OperationsAug, 08 2025
0223

The ls command is used to list the contents of a directory. By default, it displays the names of files and subdirectories in the current directory. You can also use various options with ls to modify its output, such as showing detailed information about files, sorting them, or displaying hidden files.

Here are a few common usages:

  • ls: Lists files and directories in the current directory.
  • ls -l: Lists files and directories in long format, showing details like permissions, owner, size, and modification date.
  • ls -a: Lists all files, including hidden files (those starting with a dot).
  • ls -lh: Lists files in long format with human-readable file sizes.

You can combine options as well, for example:

ls -la

This command will list all files, including hidden ones, in long format.

0 Comments

no data
Be the first to share your comment!