• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
WebSetNet

WebSetNet

Technology News

  • Technology News
    • Mobile
    • Games
  • Internet Marketing
  • System Admin
    • Windows
    • Linux
    • Mac & Apple
    • Website Scripts
      • Wordpress

Must-Know LS Command To List Directories And Subdirectories In Linux

August 5, 2020 by Martin6

Command to list directories and subdirectories in Linux Ubuntu. Use ls command to list all files in a directory in Linux; list directories and subdirectories. Linux users can also list files recursively with full path using ls command when used with various command arguments.

‘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).

Must-Know LS Command To List Directories And Subdirectories In Linux originally posted on Source Digit – Latest Technology, Gadgets & Gizmos.

Related posts:

  1. Fast Delete Complex Directories
  2. Must-Know LS Command To List Directories And Subdirectories In Linux
  3. Running out of storage? Try these tips to free up space on Windows 10
  4. Essential command tools to fix virtually any networking issue on Windows 10
  5. Amazon Alexa Easter eggs: Over 180 funny things to ask Alexa
  6. Amazon Alexa Easter eggs: Over 180 funny things to ask Alexa
  7. Amazon Alexa Easter eggs: Over 180 funny things to ask Alexa
  8. 3 Must Know File and Directory Commands in Linux Ubuntu
  9. 20+ Free Books To Learn Linux For Free
  10. 20+ Free eBooks To Learn Linux For Free

Filed Under: Uncategorized

Primary Sidebar

Trending

  • How to fix Windows Update Error 80244019
  • Windows 10 Update keeps failing with error 0x8007001f – 0x20006
  • How To Change Netflix Download Location In Windows 10
  • Troubleshoot Outlook “Not implemented” Unable to Send Email Error
  • How do I enable or disable Alt Gr key on Windows 10 keyboard
  • How To Install Android App APK on Samsung Tizen OS Device
  • 3 Ways To Open PST File Without Office Outlook In Windows 10
  • FIX: Windows Update error 0x800f0986
  • How to Retrieve Deleted Messages on Snapchat
  • Latest Samsung Galaxy Note 20 leak is a spec dump revealing key features
  • Install Android 7.0 Nougat ROM on Galaxy Core 2 SM-G355H
  • 192.168.1.1 Login, Admin Page, Username, Password | Wireless Router Settings
  • Websites to Watch Movies Online – 10+ Best Websites Without SignUp/Downloading
  • How to Backup SMS Messages on Your Android Smartphone
  • How to delete a blank page at the end of a Microsoft Word document
  • Fix: The Disc Image File Is Corrupted Error In Windows 10
  • Android 11 Custom ROM List – Unofficially Update Your Android Phone!
  • Samsung Galaxy Z Fold 3 could be scheduled for June 2021, with S Pen support

Footer

Tags

Amazon amazon prime amazon prime video Apple Application software epic games Galaxy Note 20 Galaxy S22 Plus Galaxy S22 Ultra Google Sheets headphones Huawei icloud Instagram instant gaming ip address iPhone iphone 12 iphone 13 iphone 13 pro max macOS Microsoft Microsoft Edge Mobile app office 365 outlook Pixel 6 Samsung Galaxy Samsung Galaxy Book 2 Pro 360 Samsung Galaxy Tab S8 Smartphone speedtest speed test teams tiktok Twitter vpn WhatsApp whatsapp web Windows 10 Windows 11 Changes Windows 11 Release Windows 11 Update Windows Subsystem For Android Windows 11 Xiaomi

Archives

  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org