Quantcast
Channel: Linux Help » man
Viewing all articles
Browse latest Browse all 6

Linux Usr System Directory – Ls (List Directory) Command Examples – Quick Tips

$
0
0

Linux Usr System Directory – Ls (List Directory) Command Examples – Quick Tips

By Clyde E. Boom

The Linux usr Directory

The usr directory, below the /, typically contains application software programs and utilities that can be shared across a network. It is the parent directory for many system components, including documentation files.

This directory is the “parent” for the share directory, which is the parent for doc, man and info.

These three directories contain documentation regarding Linux OS components and provide an excellent example of a well-organized directory structure.

You will see this illustrated for the “man” directories in the command examples below.

List the directories in the root and notice that the usr directory is “below” the /.

$ ls /

Now view the items in this directory.

$ ls /usr

Notice the doc, info and man directories.

Change into the share directory, below the path of /usr and list the contents.

Linux Commands Training Tips: You can use a ; (semicolon) with a space on either side, to run more than one Linux command on the same line.

$ cd /usr/share ; ls

Now use the Linux file “pattern” of “m*” to list only items beginning with “m”.

$ ls m*

This shows all items that begin with “m” and also shows the items (mostly files) in the directories beginning with “m”.

You can click on the top right arrow in your terminal emulation window to scroll up and see all of the output.

Directory names are flush left and on a single line and end in a : (colon).

Now use the -d option to show the directories only – and not the contents of the ones beginning with “m”.

$ ls -d m*

Now add the -l option to get a long listing.

$ ls -ld m*

Notice the directory named “man“. This is the parent directory of the Linux man pages, which are files providing documentation on system software components, including Linux commands.

The man command is used to view the contents of manual pages and can be run from any directory and as any Linux user.

$ man ls

This shows the man page for the ls command, which has a very brief description of the command and shows all of its options (preceded by a dash).

Press q to quit out of the man page.

Linux Commands Training Tips: Unfortunately, Linux man pages rarely show examples of how to use a command!

Now change into the man directory and view its contents.

$ clear ; cd man ; ls -ld man*

Each directory below contains files for a category of documentation.

The following command example uses the pattern of “ls.* to show the man page file in the man1 subdirectory that contains the description of the ls command that you saw above.

$ ls -l man1/ls.*

The Linux usr directory and command examples shown here apply to ALL Linux distributions, including Ubuntu, Kubuntu, Debian, SUSE, openSUSE, Fedora, Red Hat and Slackware Linux.

And now I would like to offer you free access to my Linux Commands Training Mini-Course, a 7 Lesson, Daily Mini-Course, including the free Linux Commands ebook and Linux audio podcasts – showing you how to get started learning how to use Linux commands.

You can get your instant access at: http://www.LinuxCommandsTrainingCourse.com

From Clyde Boom – The Easy Linux Training Guy – Easy, self-paced Linux training – In Plain English!


Viewing all articles
Browse latest Browse all 6

Trending Articles