Linux Directories, Linked Files & the Filesystem Hierarchy Standard

Instructor: Alexis Kypridemos

Alexis is a technical writer for an IT company and has worked in publishing as a writer, editor and web designer. He has a BA in Communication.

This lesson explains how to find files and directories on the Linux file system, as well as how to create linked files using a graphical file manager or the command line. It also explains the function of the Filesystem Hierarchy Standard.

Finding Files and Directories on the File System

The are two ways to locate files and directories on the Linux file system. Through a graphical file manager, or through the command line.

Graphical File Managers

Graphical file managers in Linux are similar to the Windows Explorer or File Explorer in Windows or the Finder in Mac OS. One difference between Linux and the other two operating systems is that while each distribution of Linux will include a default file manager, there is a wide range of options to choose from. For example, the default file manager in Fedora Linux is Nautilus, but a user could choose to install and use Nemo as their file manager instead.

The user can find files and directories in a graphical file manager by typing a search term into the file manager's search box, just as they would in Windows or Mac OS.

Command Line

The command line in Linux is an application that allows the user to control the computer with written commands, like the 'cmd' application in Windows or Terminal in Mac OS. While the default command line application in many distributions of Linux is Terminal, as with the Linux file managers, there are several other command line apps to choose from, like XTerm or Tilda.

Whichever command line application is used, the commands to find a file or directory will be the same. The main command is 'find', and this is followed by the location of where the computer is meant to search for the file, and the search terms to help find the file, like the file name. Below is an example search command:

find / -name lesson.txt

The above command will search the root folder, signified by the forward slash '/' and all subdirectories for a file named 'lesson.txt'. Please note that the '-name' argument is case sensitive. So if the file was actually named 'Lesson.txt', with a capital L, the above command would not find it. To make the command case insensitive, use the '-iname' argument instead, as in the example below:

find / -iname lesson.txt

In the above examples, the command searched the root folder and all subdirectories for the file, so essentially the entire computer. It is not necessary to search everything if the user has an idea of where the file might be, and can therefore make the search command more specific, for example:

find /home -iname lesson.txt

The above searches in the 'home' folder and all its subdirectories. The following example searches in the directory that the user is already working in and all its subdirectories:

find . -iname lesson.txt

Apart from a file name, another way to search for files is based on their file extension, for example '.txt'. Bear in mind that a command like that will find all files with that extension within the directory or directories it searches. For example:

find /home -iname ''.txt''

The above will find all '.txt' (text) files within the 'home' folder and all its subdirectories.

You can search for directories in the same was as you search for files, by specifying the name of the directory. If you want Linux to search for only directories and not files, then specify the -type argument with the 'd' flag as shown below:

find . -type d -name ''workfiles''

The above command will only search for the directory workfiles (specified by -type d) in the current directory and all its subdirectories.

What Are Links in Linux?

In Linux, a link is a connection between the filename and the actual file stored on the disk. Linux provides two types of links, hard links and soft links, also called symbolic links or symlinks. Comparing Linux links to their Windows equivalents might make them easier to understand. A hard link functions more like a copy of the original file in Windows, however, in Linux the hard link does not take up additional storage on the computer, but just points to the original stored file. Like a copy of a file Windows, a Linux hard link will continue to work even if the original file is deleted.

Soft or symbolic links, on the other hand, are similar to shortcuts in Windows. They are not a copy of the original file, but just a pointer to it. As in Windows, if the original file is deleted, a Linux symbolic link will no longer work as there is no longer a file to point to.

The key difference between hard links and soft links is that hard links are limited to files, and cannot be created for directories, nor can they be created for filesystems or partitions outside the current one, whereas soft links can be created for directories, and span filesystems and partitions.

To unlock this lesson you must be a Study.com Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use Study.com

Become a Study.com member and start learning now.
Become a Member  Back
What teachers are saying about Study.com
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 160 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? Study.com has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create An Account
Support