Linux for Starters: Your Guide to Linux – Files and Permissions – Part 10

Last Updated on May 22, 2022

This series offers a gentle introduction to Linux for newcomers.

In the previous article in this series we presented an introduction to the Bash shell. We explained the 4 types of commands that are available in the shell: Builtins, Aliases, External commands, and Functions.

In this article we’ll take you through the basics of files and permissions. We’ll use the ls command. It’s an external command provided the GNU core utilities, a package that is present on your Ubuntu installation. The package provides the basic file, shell, and text manipulation utilities (96 separate commands).

Let’s see how to list the contents of a directory in different ways, and explain what the output means. Before doing so, let’s recap the aliases that Ubuntu 21.04 has defined. As the image shows, there are 4 aliases that use ls.

Linux for Starters - aliases

We are using hyper for our screenshots rather than the default Terminal app (gnome-terminal). If you want to install hyper, see the appendix.


ls is a command that lists the contents of a directory. By default it sorts entries alphabetically. In Linux everything is represented as a file.

Had Ubuntu not defined an alias for ls, files would be output in the same color. But typing ls actually invokes the command ls --color=auto. With this option, directories are shown in blue, compressed files (such as zip files) are shown in red etc.

Linux for Starters - ls

We next run l which is an alias for ls -CF. The -C option lists entries by columns, the -F option appends an indicator to entries.

Linux for Starters - ls

In the next image, la is an alias for ls -A. This also shows hidden files (these are files which begin with a .)

Linux for Starters - ls

In the next example, we issue the command ll. That’s an alias for ls -alF. This shows hidden files, files are shown in the long format, and appends an indicator to each entry.

Linux for Starters - ls

Make your own ls alias

You may find that Ubuntu’s preconfigured aliases for ls are not what you want. For example, we prefer different options for ls, as shown in the image below.

Linux for Starters - ls

With this command, directories are grouped first before files. And file sizes are in human readable format.

Don’t type a long command each time. Let’s change the ls alias by editing ~/.bashrc with nano, a simple text editor.

$ nano ~/.bashrc

Replace the line alias ls='ls --color=auto' with alias ls='ls -lAh --group-directories-first --color=auto'. Save the file with Ctrl + O and press Return.

Then either restart the terminal or enter the command $ source ~/.bashrc

Now when we execute ls we get the output shown in the last image.

The information that you see in the long format warrants further comment.

Page 2 – What does the long listing mean?

Pages in this article:
Page 1 – ls – list the contents of a directory
Page 2 – What does the long listing mean?
Page 3 – Appendix: Installing Hyper

All articles in this series:

Linux For Starters: Your Guide to Linux
1What is Linux? Why use Linux? What do I need?
2Choose a Linux distribution meeting your specific needs and requirements.
3Make a bootable Ubuntu USB stick in Windows.
4We show you how to install Ubuntu 21.04 on your hard disk.
5Things to do after installing Ubuntu.
6Navigating your way around the Desktop.
7Updating the system, install new software.
8Open source replacements for proprietary Windows desktop software.
9Get started with the power and flexibility of the terminal.
10We cover the basics of files and permissions.
11Getting help from your system.
12Learn all about the file system.
13Manipulating files from the shell.
14Maintain your system with these simple tips.
15Managing users on your system.
16Explore different desktops to GNOME 3.
17Gaming on Linux.
18Protect your privacy with this guide.
19Access the Windows desktop from Linux using a remote desktop client.
20Set up a virtual machine running Ubuntu as the host and openSUSE as the guest.
21Wine lets you run Windows programs on Linux without emulation.
22Extend your GNOME desktop with extensions and themes.
XUseful Linux commands.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments