ls -l: How to Use the Linux Long Listing Command

petter vieve

ls -l: How to Use the Linux Long Listing Command

The ls -l command is one of the most useful basic commands in Unix and Linux systems. While ls normally provides a quick directory listing, adding -l switches the output to long format. Instead of seeing only filenames, you can inspect important filesystem metadata such as permissions, ownership, file size, timestamps and file type. GNU Coreutils documents -l as the long or verbose listing format, while Linux manual documentation describes ls as the utility for listing information about files and directories.

For a beginner, an output line such as -rw-r--r-- 1 user group 2048 Sep 5 10:30 report.txt can look complicated. In reality, each field has a defined purpose. Learning to read those fields is an important step towards understanding Linux filesystem administration.

The command is also useful beyond simple browsing. A system administrator can use it to investigate why a script cannot be executed, determine who owns a configuration file, check when an item was last modified or distinguish a symbolic link from a regular file.

That makes ls -l a small command with a surprisingly broad role. It does not change files or permissions; it reports information about them. This read-only nature makes it a sensible diagnostic tool for people learning their way around the Linux command line.

What Does ls -l Mean?

The command has two components:

ls -l

ls means list and is used to display information about files and directories.

The -l option means long format. GNU Coreutils specifies that this format displays the file type, permission bits, number of hard links, owner, group, size and timestamp, normally the modification timestamp.

When you run:

ls

you might see:

Documents
Downloads
photo.jpg
report.txt
script.sh

With:

ls -l

the result may look more like:

drwxr-xr-x 2 alice users 4096 Sep 5 09:20 Documents
drwxr-xr-x 3 alice users 4096 Sep 5 09:25 Downloads
-rw-r--r-- 1 alice users 58231 Sep 4 18:10 photo.jpg
-rw-r--r-- 1 alice users  2048 Sep 5 10:30 report.txt
-rwxr-xr-x 1 alice users   735 Sep 5 10:42 script.sh

The second version provides considerably more information without changing anything on the system.

For readers starting with command-line computing, these ideas fit naturally alongside other basic coding concepts because command-line literacy depends on understanding how computers represent and manage information.

How to Read ls -l Output

The easiest way to understand the command is to break one output line into separate fields.

Consider:

-rwxr-xr-- 1 alice developers 735 Sep 5 10:42 script.sh

The fields can be interpreted as follows:

PositionExampleMeaning
1-rwxr-xr--File type and permissions
21Number of hard links
3aliceOwner
4developersGroup
5735File size
6–8Sep 5 10:42Modification timestamp
Final fieldscript.shFilename

The precise display can vary between Unix-like implementations and according to options or filesystem features, but these are the core fields supplied by GNU ls in long format.

File Type

The first character identifies the basic file type.

Common examples include:

-    regular file
d    directory
l    symbolic link
b    block special file
c    character special file

GNU documentation lists these file-type indicators as part of the long-format output.

So:

-rw-r--r--

starts with -, meaning the entry is a regular file.

By contrast:

drwxr-xr-x

starts with d, meaning it is a directory.

This first character is easy to overlook, but it can immediately tell you whether you are looking at a file, directory or symbolic link.

Understanding Linux Permissions

The permission section is usually the part beginners find most confusing.

Take:

-rwxr-xr--

The first character identifies the file type:

-

The remaining nine characters are divided into three groups:

rwx | r-x | r--

They represent:

owner | group | others

The three permission letters are:

  • r = read
  • w = write
  • x = execute
  • - = permission not granted

Therefore:

rwx

means the owner has read, write and execute permissions.

r-x

means the group has read and execute permissions but cannot write.

r--

means other users have read permission only.

This is why ls -l is particularly useful when troubleshooting access problems. If a user cannot modify a file, the listing can reveal whether the owner, group or other-user permissions explain the behaviour.

The command itself does not modify these settings. It simply reports them.

What the Hard-Link Number Means

The number immediately after the permission string represents the number of hard links associated with the filesystem object.

For example:

-rw-r--r-- 1 alice users 2048 Sep 5 10:30 report.txt

The 1 is the link count.

Directories can have higher values because directory structures use filesystem links to represent relationships between directories and their entries.

This field is rarely important for basic desktop use, but it becomes more relevant when learning how Unix filesystems represent names and underlying filesystem objects.

It is also one reason ls -l provides more than a simple visual directory listing: it exposes information about the filesystem’s structure.

Owner and Group Information

The next two fields identify the file’s owner and group.

For example:

alice developers

means the owner is alice and the associated group is developers.

This information matters in multi-user environments. Linux permissions often depend on the relationship between a user and a file’s owner or group.

Imagine a shared development directory containing:

-rw-r----- 1 alice developers 4200 Sep 5 11:00 config.txt

The listing immediately tells an administrator who owns the file and which group has associated permissions.

When ownership is unclear, this information can be the starting point for further investigation.

GNU ls can also display numeric user and group IDs with -n, rather than resolving them to names.

File Size and Timestamps

The size field normally appears after the owner and group.

For example:

2048

indicates the file’s size in bytes under the normal long-format display.

If the file is large, ls -lh is easier to read:

ls -lh

The -h option produces human-readable sizes such as K, M or G. GNU documentation specifies that human-readable output uses powers of 1024 for these abbreviated units.

The timestamp normally represents the file’s modification time.

For example:

Sep 5 10:30

tells you when the file was last modified, subject to the timestamp formatting and filesystem details.

This can be particularly useful when troubleshooting configuration changes. If a service suddenly behaves differently, checking modification times can help establish which files were changed recently.

Useful ls -l Variations

The basic command becomes much more powerful when combined with other options.

CommandMain purposeTypical use
ls -lLong listingInspect metadata
ls -lhLong + human-readable sizesRead large file sizes easily
ls -laLong + hidden filesInspect configuration files
ls -ltLong + newest firstFind recently modified files
ls -lSLong + largest firstIdentify large files
ls -lnLong + numeric IDsInspect raw UID/GID values
ls -lRLong + recursiveInspect directory trees
ls -ld directoryList directory itselfInspect directory metadata

The GNU manual documents options including -h, -i, -n, -R, -t and other variations of the standard listing behaviour.

ls -la: Finding Hidden Files

One of the most useful combinations is:

ls -la

The -a option tells ls to include entries whose names begin with a dot.

Linux and Unix systems commonly use dot-prefixed filenames for configuration and other hidden entries.

For example:

.bashrc
.profile
.config

A normal:

ls -l

may not show them.

Using:

ls -la

reveals them alongside ordinary files.

This is especially useful when troubleshooting shell configuration or looking for application settings stored in a user’s home directory.

ls -lh: Making Sizes Easier to Read

If a directory contains large files, raw byte counts can be difficult to interpret.

Compare:

ls -l

with:

ls -lh

A file might appear as:

-rw-r--r-- 1 alice users 104857600 Sep 5 11:20 archive.zip

With -h, the size can be displayed in a more readable abbreviated form.

This is useful during storage investigations because the human-readable representation makes it easier to identify unusually large files without manually converting byte counts.

The distinction is important: -h changes the presentation of the size; it does not change the file itself.

Sorting Files with ls -l

The standard long listing can also be sorted.

To see recently modified entries first:

ls -lt

To reverse that order:

ls -ltr

To sort by size:

ls -lS

These combinations are useful for practical system administration.

For example, if you are investigating which files changed most recently, ls -lt can provide a quick first view. If disk usage is a concern, ls -lS can help identify large entries.

GNU ls supports multiple sorting controls, including modification time and file size.

Symbolic Links and ls -l

Symbolic links are another area where long listings become valuable.

Suppose the output contains:

lrwxrwxrwx 1 alice users 18 Sep 5 11:40 current -> releases/v4

The initial l identifies the entry as a symbolic link.

The arrow:

current -> releases/v4

shows the link’s target.

This can be useful when applications use symbolic links to point to changing versions of software or configuration directories.

GNU ls also provides -L, which changes how information about symbolic links is handled by dereferencing the link to inspect the referenced file.

ls -l Versus ls -ld

There is an important difference between:

ls -l directory

and:

ls -ld directory

Without -d, ls generally lists the contents of a directory.

With -d, it treats the directory entry itself as the item to list.

Therefore:

ls -ld /var/log

is useful when you want to inspect the permissions, owner, group and metadata of /var/log rather than immediately listing everything inside it.

This distinction is particularly helpful when diagnosing directory-access permissions.

When Should You Use ls -l?

The command is useful in several common situations.

Checking permissions

If a script does not execute, inspect its permissions:

ls -l script.sh

You might discover that the execute bit is missing.

Checking ownership

If an application cannot access a configuration file, check:

ls -l config.conf

The owner and group may explain the problem.

Checking recent changes

Use:

ls -lt

to place recently modified entries first.

Checking hidden configuration files

Use:

ls -la

when ordinary output does not show the file you expect.

Inspecting storage

Use:

ls -lh

to make file sizes easier to interpret.

These uses demonstrate an important practical point: ls -l is not merely a beginner command. It remains useful because filesystem metadata is relevant to both routine work and technical troubleshooting.

Risks and Limitations of ls -l

Despite its usefulness, the command should not be treated as a complete filesystem diagnostic tool.

First, its output is designed primarily for human-readable display. GNU’s documentation describes formatting intended for users, while the POSIX-oriented manual documentation warns that ls -l output is not a format intended to be directly translated into commands or reliably parsed by applications.

This creates an important scripting lesson.

If a program needs structured file metadata, parsing the visual columns of ls -l can be fragile. Filenames can contain spaces and unusual characters, and different implementations may format output differently.

For shell scripts, specialised utilities and shell features are often safer when machine-readable information is required.

A second limitation is that the timestamp shown is normally the modification time. It should not automatically be interpreted as the creation time.

A third limitation is that permission information does not always explain the complete access-control picture. Modern systems can include additional mechanisms such as ACLs or security contexts.

GNU ls can expose some additional information through options such as -Z on systems supporting security contexts.

Three Practical Insights Beginners Often Miss

1. Long format is diagnostic, not administrative.
Running ls -l does not fix permissions, change ownership or modify timestamps. It gives you evidence that can help decide what action is appropriate. That separation between observation and modification is valuable when learning system administration.

2. The filename is only one part of the filesystem picture.
Two files with similar names can have very different owners, permissions, sizes and modification times. Looking only at filenames can therefore hide the reason a command or application behaves differently.

3. Human-readable output is not automatically script-friendly.
The convenience of columns is precisely what can make ls -l unsuitable for automated parsing. GNU and POSIX documentation both distinguish human-facing listings from information that software can safely consume.

These distinctions become increasingly important as a learner moves from basic terminal use towards shell scripting and system administration.

Real-World Command-Line Context

Linux users frequently encounter command-line tools while managing software, network configuration and services.

For example, RubbleMagazine’s guide to deleting Hiddify on Linux demonstrates how terminal commands can be used during software removal and troubleshooting.

Similarly, its guide to DNS server troubleshooting covers command-line utilities such as nslookup, ping and tracert as part of diagnosing connectivity problems.

The significance of ls -l in these environments is straightforward: administrators often need to establish what exists, who owns it, how it is permissioned and when it changed before deciding what to do next.

That makes file listing one of the foundational skills supporting broader command-line workflows.

A Simple Beginner Workflow

A sensible progression is:

ls

Start with a basic list.

Then:

ls -l

Learn to read permissions, ownership, size and timestamps.

Next:

ls -lh

Make file sizes easier to understand.

Then:

ls -la

Include hidden files.

Finally:

ls -lt

Practise interpreting timestamps and sorting.

This sequence introduces additional information gradually rather than forcing a beginner to understand every option at once.

Once comfortable, combine options:

ls -lath

This can provide a detailed listing including hidden files, human-readable sizes and time-based sorting. However, combinations should be learned by understanding each individual option rather than memorising arbitrary command strings.

The Future of ls -l in 2027

The basic purpose of ls -l is unlikely to change significantly in 2027. File metadata remains fundamental to Unix and Linux systems, and long-format listings continue to provide a convenient human-readable representation.

The more meaningful change is likely to be around how people interact with command-line environments. AI-assisted development and administration tools can generate shell commands, explain output and help users diagnose errors. Yet that makes understanding commands such as ls -l more valuable, not less.

A user who understands the permission string can evaluate whether a generated command makes sense. Someone who recognises the difference between a regular file and symbolic link is better positioned to spot an unsafe assumption.

The infrastructure reality also matters. Linux remains deeply embedded in servers, cloud systems, development environments and technical infrastructure. A simple filesystem inspection command therefore retains relevance even as interfaces around it become more sophisticated.

The likely future is not replacement but layering: automated tools may help interpret terminal output, while the underlying Unix concepts remain necessary for verification.

Key Takeaways

  • ls -l means list directory contents in long format.
  • It displays file type, permissions, hard-link count, owner, group, size and modification time.
  • The first character of the permission field identifies the file type.
  • Permission characters describe access for the owner, group and other users.
  • ls -lh makes file sizes easier to read.
  • ls -la includes hidden files.
  • ls -lt sorts entries by modification time.
  • ls -l is excellent for human inspection but should not automatically be treated as a machine-readable data format.

Conclusion

ls -l is a small command, but it introduces several of the central ideas behind Unix and Linux filesystem management. A basic ls listing tells you what names exist; the long format tells you much more about what those entries actually represent.

By learning to read the file type, permission bits, hard-link count, owner, group, size and modification timestamp, beginners gain a practical understanding of how Linux organises files and controls access.

The command is also useful well beyond introductory learning. Administrators use it to investigate ownership, permissions, symbolic links, recently changed files and storage-related questions. Its greatest value is that it provides evidence without modifying the filesystem.

The main caution is equally important: human-readable output is not necessarily suitable for automated parsing. Once that distinction is understood, ls -l becomes more than a command to memorise. It becomes a reliable first step for examining what is happening inside a Linux filesystem.

Frequently Asked Questions

What does ls -l do in Linux?

ls -l lists files and directories using long format. Instead of showing only names, it displays metadata including file type, permissions, hard-link count, owner, group, size and modification time.

How do I use ls -l to see file permissions?

Run:

ls -l

The first part of each output line contains the file type followed by nine permission positions. These represent read, write and execute permissions for the owner, group and other users.

What is the difference between ls and ls -l?

ls normally provides a concise directory listing. ls -l uses long format and displays additional filesystem metadata. GNU documentation identifies -l as the long-format option.

How can I see hidden files with a long listing?

Use:

ls -la

The -a option tells ls to include entries beginning with a dot, while -l retains the long-format information.

How do I display file sizes in a readable format?

Use:

ls -lh

The -h option produces human-readable size units, making large byte counts easier to interpret.

Can ls -l show who owns a file?

Yes. The long-format output includes the owner and group fields. For example, an output line may identify alice as the owner and developers as the group.

Is ls -l safe to use?

Yes. The command is primarily a listing and inspection utility. Running ls -l does not itself modify permissions, ownership or file contents. Care is required with other commands used after inspecting the output.

Methodology

This article was researched against current technical documentation, with GNU Coreutils used as the primary source for the behaviour and output of ls. The current GNU Coreutils documentation identifies -l as the long-format option and documents the metadata fields displayed by that format.

The Linux manual page for ls was used as a secondary technical validation source, including its descriptions of -l, -a, -h, -n, -R, -t and symbolic-link handling. The manual page currently identifies GNU coreutils 9.11 and was generated from the April 2026 release documentation.

The article also considers the distinction between human-readable command output and machine-readable data. POSIX-oriented documentation warns against treating the visual output of ls -l as a directly parseable format, which is an important practical limitation for shell scripting.

RubbleMagazine.co.uk’s published technical articles were reviewed to identify relevant internal links. Three links were selected because they relate directly to command-line use, Linux troubleshooting or broader programming fundamentals.

No fabricated interviews, personal testing results or invented performance measurements have been used. The practical examples are explanatory command-line examples rather than claims of private testing.

Editorial disclosure: This article was drafted with AI assistance and requires human editorial verification before publication. Editors should independently confirm command behaviour, references and internal links against the original sources before publishing.

References

GNU Project. (2026). GNU Coreutils 9.11 manual: ls: List directory contents. Free Software Foundation.

GNU Project. (2026). GNU Coreutils 9.11 manual: What information is listed. Free Software Foundation.

Linux man-pages project. (2026). ls(1) — Linux manual page. man7.org.

Linux man-pages project. (2026). ls(1p) — Linux manual page. man7.org.

RubbleMagazine.co.uk. (2026). Basic coding concepts: The essential foundations every beginner should understand. RubbleMagazine.co.uk.

RubbleMagazine.co.uk. (2024). How to delete Hiddify: A step-by-step guide. RubbleMagazine.co.uk.

RubbleMagazine.co.uk. (2025). DNS server not responding: Guide to diagnosis and resolution. RubbleMagazine.co.uk.