Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
  • https://www.facebook.com/
  • https://twitter.com/
  • https://t.me/
  • https://www.instagram.com/
  • https://youtube.com/
https://pctechmag.co.uk/ PC Tech Mag

Tech news, gadget reviews, tips, and digital trends — PC Tech Mag keeps you informed on everything technology.

https://pctechmag.co.uk/ PC Tech Mag

Tech news, gadget reviews, tips, and digital trends — PC Tech Mag keeps you informed on everything technology.

  • Home
  • About us
  • Contact us
  • Tech

About This Site

PC Tech Mag is an online tech magazine with PC hardware and gaming guides, Windows tips, software explainers and gadget coverage.

Recent Posts

  • How to Find Duplicates in Google Sheets: 5 Easy Methods
  • How to Add Speaker Notes in PowerPoint: A Step-by-Step Guide
  • Lighter Linux: The Best Lightweight Linux Distros for Old and Slow PCs
  • Ubuntu vs Mint: Which Linux Distro Should You Choose in 2026?
  • How Do I Send a GIF in a Text Message? A Complete Guide for iPhone and Android

Meta

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

Find Us

Contact: farmanali5starseo@gmail.com

  • Home
  • About us
  • Contact us
  • Tech
Subscribe
Close

Search

Linux terminal listing hidden files with ls -a — show hidden files in linux
Windows & PC Tips

ls -la: What the Linux ls -la Command Does, With Examples

By admin
November 23, 2026 8 Min Read
1

The ls -la command is one of the first Linux commands every beginner learns, and one of the most useful commands you will use every day. In short, ls -la lists all files in a directory, including hidden files, and shows detailed information about each one, such as permissions, owner, size, and last modified date.

Once you understand what each column means, ls -la becomes a powerful way to check what is in a folder, who can read or change a file, and why a script will not run. This guide explains ls -la in plain language, breaks down the output column by column, and gives practical examples you can try in any Linux terminal, on a Mac, or in Windows Subsystem for Linux.

What Does ls -la Do?

The ls command lists files and directories. The -l option tells it to use the long format, with one file per line and extra details. The -a option tells it to show all files, including hidden files whose names start with a dot. Together, ls -la means list all files in long format.

Run ls -la in a directory and you will see something like this:

total 48
drwxr-xr-x  5 aisha aisha 4096 Nov 23 10:15 .
drwxr-xr-x 12 aisha aisha 4096 Nov 23 09:40 ..
-rw-r--r--  1 aisha aisha  220 Nov 23 09:40 .bashrc
-rw-r--r--  1 aisha aisha  845 Nov 23 10:02 notes.txt
drwxr-xr-x  2 aisha aisha 4096 Nov 23 10:15 projects
-rwxr-xr-x  1 aisha aisha  120 Nov 23 10:10 backup.sh

The first line, total 48, is the total number of disk blocks used by the files in the listing. The lines that start with . and .. are the current directory and the parent directory. The .bashrc file is a hidden file, and it only appears because you used -a. Without -a, ls -l would hide it.

Breaking Down the ls -la Output

Each line in the long format has the same structure. Learning to read it is the key to using ls -la well.

Column Example What it means
File type and permissions -rw-r–r– First character is the type, next nine are permissions
Links 1 Number of hard links to the file
Owner aisha The user who owns the file
Group aisha The group that owns the file
Size 845 Size in bytes, or size of a directory entry
Date and time Nov 23 10:02 When the file was last modified
Name notes.txt The file or directory name

File type and permissions

The first character tells you the type. A dash – means a regular file, d means a directory, and l means a symbolic link. The next nine characters are three groups of three: owner, group, and others. Each group can have r for read, w for write, and x for execute, or a dash if that permission is missing.

For example, -rw-r–r– means a regular file where the owner can read and write, and the group and others can only read. The entry drwxr-xr-x means a directory where the owner can read, write, and enter it, and the group and others can read and enter it. The entry -rwxr-xr-x means a regular file that is executable, such as a script, where everyone can run it.

Owner, group, and size

The owner and group columns tell you who owns the file and which group it belongs to. If you need to change them, you use chown and chgrp. The size column is in bytes by default. For a directory, the size is the size of the directory entry itself, not the total size of the files inside it. Use du -sh to see the total size of a directory.

ls -la Examples You Can Use Today

Here are the most useful variations of ls -la, with what each one is for.

1. List the current directory

ls -la

This lists all files, including hidden ones, in the directory you are in now.

2. List a specific directory

ls -la /home/aisha/projects
ls -la ~/Documents

Give ls -la a path, and it lists that directory instead of the current one. The tilde ~ means your home directory.

3. Show sizes in human-readable form

ls -lah

The -h option makes sizes readable, so 845 becomes 845, 2048 becomes 2.0K, and 1048576 becomes 1.0M. This is the form most people use day to day.

4. Sort by time, newest first

ls -lat

The -t option sorts by modification time, newest first. This is useful when you want to find the file you just edited or downloaded.

5. Sort by size, largest first

ls -laS

The -S option sorts by file size, largest first. Use it to find the files that are taking up the most space.

6. List in reverse order

ls -lar

The -r option reverses the sort order. Combined with -t, it shows the oldest files first.

7. Show one file in long format

ls -la notes.txt

Give ls -la a file name, and it shows the long format for just that file. This is a quick way to check the permissions of one file.

8. Combine ls -la with grep

ls -la | grep ".txt"
ls -lah | grep "^-"

Piping ls -la to grep lets you filter the output. The first example shows only .txt files, and the second shows only regular files, not directories.

Hidden Files and the -a Option

Files whose names start with a dot are hidden in Linux. They are not hidden for security; they are hidden to keep your home directory tidy. Configuration files such as .bashrc, .profile, .gitconfig, and .ssh are all hidden files, and they control how your shell, your editor, and your tools behave.

The -a option is the only way to see them with ls. Without it, you might think a directory is empty when it actually contains important configuration files. If a program is not working as expected, ls -la is often the first command to run, because a missing or wrongly permissioned hidden file is a common cause.

Be careful when you delete hidden files. Deleting .bashrc will not delete your home directory, but it will remove your shell customisations. Always check what a hidden file does before you remove it, and back it up first.

How to Change Permissions After ls -la

When ls -la shows that a file does not have the permissions you need, you can change them with chmod. The most common cases are making a script executable, and removing write permission from a file you do not want to change by accident.

chmod +x backup.sh
chmod 644 notes.txt
chmod 755 projects

The first command adds execute permission to backup.sh. The second sets notes.txt to read and write for the owner, and read only for the group and others. The third sets the projects directory to read, write, and execute for the owner, and read and execute for the group and others.

If you change permissions and a program still cannot read a file, check the owner with ls -la, and check the parent directory permissions as well. A file can be readable, but if its parent directory is not executable, you cannot reach it. If you are learning Python on Linux, our guide on how to check the Python version will help you confirm which Python your scripts will use, and our guide on how to format an SSD explains how storage and file systems work on a PC.

ls -la vs ls, ls -l, and ls -a

Command Shows hidden files? Shows details? Best for
ls No No A quick list of visible files
ls -l No Yes Checking permissions of visible files
ls -a Yes No A quick list including hidden files
ls -la Yes Yes A full check of a directory
ls -lah Yes Yes, readable sizes Everyday use

Most experienced Linux users use ls -lah as their default, because it gives the most information in the most readable form. You can even make it your default by adding an alias to your .bashrc file, for example alias ll=’ls -lah’. After that, typing ll will run ls -lah for you.

Common ls -la Mistakes

The most common mistake is forgetting that ls -la shows the current directory, not the directory you think you are in. Always check where you are with pwd before you run ls -la, especially after you use cd. Another common mistake is reading the size of a directory as the total size of its contents, which it is not. Use du -sh for that.

A third mistake is assuming that a file with no execute permission cannot be run at all. A Python script, for example, can be run with python script.py even if it is not executable, because Python reads the file. The execute permission matters when you run the script directly, as ./script.py. If you see Permission denied when you try to run a script, ls -la will show you whether the x is missing.

Frequently Asked Questions

What does ls -la mean in Linux?

ls -la lists all files in a directory in long format. The ls command lists files, -l shows detailed information such as permissions, owner, and size, and -a shows hidden files whose names start with a dot.

What is the difference between ls and ls -la?

ls shows only visible files, in a short list with no details. ls -la shows all files, including hidden ones, with one file per line and full details about permissions, owner, group, size, and modification date.

How do I see hidden files in Linux?

Use ls -la or ls -a. Hidden files start with a dot, such as .bashrc, and are not shown by plain ls. You can also use ls -lah to see them with human-readable sizes.

How do I make ls -la show readable file sizes?

Add the -h option, as in ls -lah. This shows sizes as 2.0K, 1.5M, or 3.2G instead of a raw number of bytes.

Why does ls -la show . and ..?

The dot . is the current directory, and .. is the parent directory. They appear in ls -la because -a shows all entries, including these special directory links. You can ignore them in most cases, but they are useful when you want to refer to the current or parent directory in a command.

Once you can read ls -la output, you can answer most questions about a Linux directory in seconds: what is here, who owns it, who can change it, and when it was last changed. That is why it is one of the first commands to learn, and one of the last you will stop using.

A Linux terminal window showing command-line text on a dark screen, illustrating how to run the netstat command to view network connections
Author

admin

Follow Me
Other Articles
Two computer screens showing green spreadsheet grids with an arrow between them, representing working with Excel spreadsheets
Previous

TSV File Format: What Is a TSV File and How to Open and Create One

Python code open in a modern code editor on a monitor — best python ides
Next

How to Connect an Autoresponder for WhatsApp With ChatGPT API: A Step-by-Step Guide

One Comment
  1. sudo rm -rf: What It Does, Why It Is Dangerous, and Safer Ways to Delete Files - PC Tech Mag says:
    November 30, 2026 at 6:09 am

    […] expect, that it is the folder you mean, and that there is nothing important inside it. Our guide to ls -la in Linux, and what each column means explains how to read that listing, including file sizes, owners, and permissions. If the listing […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

About This Site

PC Tech Mag is an online tech magazine with PC hardware and gaming guides, Windows tips, software explainers and gadget coverage.

Search

Recent Posts

  • How to Find Duplicates in Google Sheets: 5 Easy Methods
  • How to Add Speaker Notes in PowerPoint: A Step-by-Step Guide
  • Lighter Linux: The Best Lightweight Linux Distros for Old and Slow PCs
  • Ubuntu vs Mint: Which Linux Distro Should You Choose in 2026?
  • How Do I Send a GIF in a Text Message? A Complete Guide for iPhone and Android

Find Us

Contact: farmanali5starseo@gmail.com

About This Site

PC Tech Mag is an online tech magazine with PC hardware and gaming guides, Windows tips, software explainers and gadget coverage.

Recent Posts

  • How to Find Duplicates in Google Sheets: 5 Easy Methods
  • How to Add Speaker Notes in PowerPoint: A Step-by-Step Guide
  • Lighter Linux: The Best Lightweight Linux Distros for Old and Slow PCs
  • Ubuntu vs Mint: Which Linux Distro Should You Choose in 2026?
  • How Do I Send a GIF in a Text Message? A Complete Guide for iPhone and Android

Archives

  • December 2026 (15)
  • November 2026 (192)
  • October 2026 (85)

Find Us

Contact: farmanali5starseo@gmail.com

Copyright 2026 — PC Tech Mag. All rights reserved. Blogsy WordPress Theme