• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Source Digit

Source Digit

Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • How To
  • Ubuntu
  • Instagram
  • Blogging
  • Android
  • WordPress
  • +More
    • Cloud Computing
    • Gadgets
    • Social Media
    • Technology
  • Write for Us
Home / How To / Use ls Command to List Directories & to Show Hidden Files

Use ls Command to List Directories & to Show Hidden Files

By Sourabh / November 20, 2020 Category: How To, Ubuntu

ls command to list directories and ls command to list all files in subdirectories. What is the option in ls command to display the hidden files or directories?

This post explains the ls command in Linux with examples to list directories and subdirectories

 ‘ls’ Command Examples in Linux

ls command is use to lists the files in the current working directory.  List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor –sort is specified.

The ls command is used in the following format ls [OPTION]… [FILE]…

The ‘ls’ program lists information about files and directories, not recursively, and omitting files with names beginning with ‘.’.  By default ‘ls’ lists just the file name and ‘ls’ operates on the current directory. By default, the output of the ‘ls’ command is sorted alphabetically.

ls Examples

When ls command is used with no option, it list files and directories with details like file types, size, modified date and time and permission.

But there are many options that can be used with ls command to get the desired output. Let us see some of those command examples:

ls ~

It will list the contents of your home directory.

ls /

It will list the contents of the root directory.

ls ../

It will list the contents of the parent directory.

ls */

It will list the contents of all subdirectories.

ls -a or ls –all

List all files including hidden file starting with ‘.‘. When used, the command do not ignore file names that start with ‘.’. Another variation of the commands is ls -A or ls –almost-all. This command does not ignore all file names that start with ‘.’; ignore only ‘.’ and ‘..’.  The ‘–all’ (‘-a’) option overrides this option.

ls -d or ls –directory

It will list just the names of directories, as with other types of files, rather than listing their contents. This command can also be used to display a list of directories in the current directory. To do so use the ls -d */ command.

ls -lh

It will list the file sizes in human readable format.

ls -r

It will display files and directories in reverse order.

ls -lS

It will sort the file list by size, which is it will displays file size in order, big size file will be displayed first.

ls -lt

It will list and sort it by modification time. The output shows the most recently modified files or folders at the top of the list.

ls -laxo

It will lists files with permissions, shows hidden files, displays them in a column format, and suppresses group information.

ls *.{htm,php}

It will list all files containing the file extension .htm or .php

ls [aeiou]*

It will list only files that begin with a vowel (a, e, i, o, or u).

Tags: "Ls -Ltr" Unix, Cd Command In Linux, File Management In Linux Operating System, File System Commands In Linux With Examples, File System Navigation In Linux, Filesystem In Linux, Linux File System Commands Pdf, Linux File System Tutorial Pdf, Linux List Directories And Subdirectories, Linux List Files Recursively With Full Path, Linux Ls Command, Linux Ls Command Example, List All Files In A Directory Linux, List All Files In A Directory Windows, Ll Command In Linux, Ls -Ltr Command Output, Ls -Ltr Unix Example, Ls Command Example Linux, Ls Command Example Ubuntu, Ls Command Example Unix, Ls Command Examples In Linux, Ls Command Examples In Ubuntu, Ls Command Examples In Unix, Ls Command In Unix With Examples, Ls Command In Windows, Ls Command Linux, Ls Command Ubuntu, Ls Command Unix, Ls In Unix, Ls Long Listing Format, Ubuntu Ls Command, Ubuntu Ls Command Example, Unix Command To List Directories And Subdirectories, Unix File System Structure, Unix Fs Command, Unix List All Files In Subdirectories, Unix Ls Command, Unix Ls Command Example

Primary Sidebar

Latest Posts

Ubuntu 25.04 ‘Plucky Puffin’ Is Available To Download

How to Login as Root User in Linux Terminal

Install Firefox In Ubuntu Terminal Command Line

How To Check Kernel Installed Date In Linux Ubuntu

How To List All Kernel Modules That Are Loaded In Ubuntu

Enable Ubuntu Auto Login Without Password

Download Ubuntu 25.04 Official Default Wallpapers

How To Fix Initramfs Error In Ubuntu Command Line

How To Check All Available Kernel Version In Linux Ubuntu

3 Best Artificial Intelligence Domain Name Generators

© 2025 Source Digit • Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • About
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
  • Sitemap