Linux Mount: Quickie

SUSE Linux distributions
Image via Wikipedia

The Linux mount command is used to mount a filesystem by assigning a mount point (such as a directory below the /mnt directory) to a hard disk partition or other disk device, such as a CD-ROM drive.

After the partition or device has been mounted, it can be accessed by application Linux software programs, utilities and commands.

Example of Using the Linux mount Command

For example, the following command:

$ mount /dev/cdrom /mnt/cdrom causes the device file named cdrom in the /dev directory to be mounted “onto” the cdrom directory below /mnt.

The cdrom directory becomes the “mount point” for the CD and this allows you to access the filesystem of the CD.

The files in the / (root) directory of the CD become accessible below the full path of /mnt/cdrom.

Listing the Contents of the Linux /dev System Directory Below The / (Root) Directory

Many of the important Linux system directories, such as the /dev directory, are located directly below the / (root) directory.

Now look at the contents of the /dev directory and find out what Linux uses it for.

Examples of Using the Linux ls Command to the List System Directories and the /dev Directory

The following command lists the contents of the / directory – from any directory. The “-l” option of the ls command is not required here.

$ ls / Notice the dev directory, which is below the / (root) directory in the full path of /dev.

Viewing the Contents (Directories and Files) in the /dev Directory Path

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

$ ls /dev Example of Using the Linux nl Command To Number Lines of Output

The Linux nl (number line) command can be used to count and display the number of lines in a file or the output of a command.

In the folloinwg example, the output of the ls command is “piped” (with the vertical bar symbol) to the nl command to display a count of the output of the command.

$ ls -l /dev | nl This shows the device driver files for many different types of Linux hardware devices that are located in /dev and a count of the number of them.

Linux Commands Training Tips: On more current Linux systems, the mount command may not be required and your devices may automatically mount below the /media directory. For example, if you put a CD in your drive and it automatically appears on your Linux desktop, you do not need to use the mount command to do the steps in the command example above. The Linux ls command and dev system directory concepts covered here apply to ALL Linux distributions and versions, including Ubuntu, openSUSE, Debian, SUSE, Fedora, Slackware and Red Hat Linux.

By the way…do you want to learn exactly how to use Linux and run Linux commands for Linux System Administration and get real, practical Linux training experience by running hundreds of examples of Linux commands? Stay tune as I add more about Linux.

Other related articles:

Enhanced by Zemanta

Technorati Tags: , , , ,

This entry was posted on Thursday, October 22nd, 2009 at 6:17 pm and is filed under Networking. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

4 Responses to “Linux Mount: Quickie”

  1. October 22nd, 2009 at 9:37 pm

    Understanding Linux Filesystems | Sekolah Linux Indonesia says:

    [...] you are want to become Linux administrator then you like to know more about linux mount as [...]

  2. July 18th, 2010 at 2:14 am

    Radiology Technician says:

    Thanks for sharing. It is good information.

  3. July 26th, 2010 at 2:40 pm

    ak 3ds market says:

    It is so cute, Although I do not know what is going on…

  4. July 27th, 2010 at 1:02 pm

    Matha Lorentz says:

    Great website: Do you agree that one of the finest bookkeeping software programs on the market is Intuit Quickbooks for everyday use. I am looking for some input on what to purchase. Thanks again!

Leave a Reply

Anti-Spam Protection by WP-SpamFree