Linux Etc System Directory – List (Ls) Command Examples – Quick Tips For Linux Commands


Listing the Linux / etc Directory Contents – A System Directory Below The / (Root) Directory

Many of the Linux OS system directories are located directly below the / (root) directory and the etc directory is one of them.

Now look at the / etc directory contents and find out what the Linux OS uses this directory for.

Linux ls Command Examples Listing the System Directories and the / etc Directory

The following command lists all directories in the / (root) beginning with e, due to e * "pattern". The -l for "long listing" and -d for "directories only" options are used. You will see one directory and possibly (but not likely) more than one.

    $ Ls -ld / e *

The etc directory, which is below the / (root) directory in the full path of / etc appears.

Viewing the Contents in the / etc Directory Path

Now run the following command to see the contents of the etc directory, without having to change directory.

The output of the ls command is being "piped" to the nl command (due to the vertical bar between commands) to show the number of items (directorie and files) in the etc directory.

    $ Ls -l / etc | nl

Notice the number of items that appear.

Among many other things, the etc directory contains many system configuration text files that are used by the Linux OS.

Now use the pattern of * .conf to list all of the configuration files ending in .conf.

There are also many other Linux system, server, and other configuration files in the etc directory. Some with different file name "endings" and also some with different file names.

    $ Ls -l /etc/*.conf | nl | less

Scroll down to have a look at the output, that has been paused with the less command, and the press q to quit out of this command.

The Linux ls command examples and the etc system directory concepts covered here apply to ALL Linux distributions and versions, including Debian, SUSE, Ubuntu, openSUSE, Fedora, Slackware and Red Hat Linux.


Leave a Reply