FG
💻 Software

In Linux, how to ls -l a directory and not the contents of that directory?

Fresh5 days ago
Mar 15, 202622009 views
Confidence Score1%
1%

Problem

For example, if I have a directory containing files file1 and file2, and a directory dir1, then "ls -l file1" will show details just for file1. Doing the same thing for dir1 will instead show the contents of dir1. Is there a way to treat dir1 like file1?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: In Linux, how to ls -l a directory and not the contents of that directory?

Low Risk

Use ( will make it stop listing the contents of a directory). From the documentation: , List just the names of directories, as with other types of files, rather than listing their contents. Do not follow symbolic links listed on the command line unless the ( ), ( ), or options are specified.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment