Skip to main content

Linux ls Command: List Files, Folders, and Hidden Files

HardReset.InfoJanuary 5, 20264 min8 views
5 connections·6 entities in this video→

Opening the Terminal and Basic ls Command

  • πŸ’» Open the terminal application to begin using Linux commands.
  • πŸ“„ The ls command is used to list files and folders.
  • πŸ“‚ By default, ls in the home directory shows only folders.
  • ➑️ Use cd /etc to navigate to a directory with more files and folders to demonstrate ls effectively.

Advanced ls Command Options

  • ℹ️ The ls command can be enhanced with options to display more information.
  • πŸ“ ls -l provides a long listing format, showing permissions, size, and modification timestamps.
  • 🀫 ls -a reveals hidden files and folders, which are typically prefixed with a dot (.).
  • πŸŽ›οΈ Combine options like ls -la to see hidden files in a long format.

Enhancing ls Output Readability and Sorting

  • πŸ“ ls -h displays file sizes in a human-readable format (e.g., KB, MB) when used with -l (e.g., ls -lh).
  • βš–οΈ ls -S sorts files by size, with the largest files listed first.
  • πŸš€ Combine options for a comprehensive view: ls -lhS shows human-readable sizes, long format, and sorts by size.
  • πŸ”„ ls -r reverses the sort order, displaying items from Z to A or smallest to largest if sorted by size.

Listing Only Directories

  • πŸ“ To list only directories, use the command ls -d */.
  • 🎯 This command specifically filters the output to show only directory entries.
Knowledge graph6 entities Β· 5 connections

How they connect

An interactive map of every person, idea, and reference from this conversation. Hover to trace connections, click to explore.

Hover Β· drag to explore
6 entities
Chapters2 moments

Key Moments

Transcript17 segments

Full Transcript

Topics13 themes

What’s Discussed

Linuxls commandTerminalList filesList foldersHidden filesFile permissionsFile sizeTimestampsHuman-readable sizesSort files by sizeReverse orderList directories
Smart Objects6 Β· 5 links
ProductΒ· 1
ConceptsΒ· 5