What is the full path to the directory that holds the man files on the system?

As a new Linux user, one of the first skills that you need to master is navigating the Linux filesystem. These basic navigation commands will get you up to speed.

Posted: February 24, 2020 |%t min read| by Keerthi Chinthaguntla [Sudoer alumni]

Image

Photo by Ylanite Koppens from Pexels

The basics

More Linux resources

  • Advanced Linux commands cheat sheet
  • Download RHEL 9 at no charge through the Red Hat Developer program
  • A guide to installing applications on Linux
  • Linux system administration skills assessment

Before we get into commands, let’s talk about important special characters. The dot [.] , dot-dot [..] , forward slash [/], and tilde [

$ cd /home
0], all have special functionality in the Linux filesystem:

  • The dot [.] represents the current directory in the filesystem.
  • The dot-dot [..] represents one level above the current directory.
  • The forward slash [/] represents the "root" of the filesystem. [Every directory/file in the Linux filesystem is nested under the root / directory.]
  • The tilde [
    $ cd /home
    
    0] represents the home directory of the currently logged in user.

I believe that the best way to understand any concept is by putting it into practice. This navigation command overview will help you to better understand how all of this works.

Print working directory [
$ cd /home
6]

The

$ cd /home
6 command prints the current/working directory, telling where you are currently located in the filesystem. This command comes to your rescue when you get lost in the filesystem, and always prints out the absolute path.

What is an absolute path? An absolute path is the full path to a file or directory. It is relative to the root directory [/]. Note that it is a best practice to use absolute paths when you use file paths inside of scripts. For example, the absolute path to the

$ cd /home
9 command is:
$ cd /
0.

Image

If it’s not absolute, then it’s a relative path. The relative path is relative to your present working directory. If you are in your home directory, for example, the

$ cd /home
9 command's relative path is: .
$ cd /
2.

Change directory [
$ cd /
3]

The

$ cd /
3 command lets you change to a different directory. When you log into a Linux machine or fire up a terminal emulator, by default your working directory is your home directory. My home directory is
$ cd /
5. In your case, it is probably
$ cd /
6.

Absolute and relative paths make more sense when we look at examples for the

$ cd /
3 command. If you need to move one level up from your working directory, in this case
$ cd /
8, we can do this couple of ways. One way is to issue a
$ cd /
3 command relative to your
$ cd /home
6:

$ cd ..

Note: Remember, .. represents the directory one level above the working directory.

The other way is to provide the absolute path to the directory:

$ cd /home

Either way, we are now inside

$ cd /
8. You can verify this by issuing
$ cd /home
6 command. Then, you can move to the filesystem’s root [/] by issuing this command:

$ cd /

If your working directory is deeply nested inside the filesystem and you need to return to your home directory, this is where the

$ cd /home
0 comes in with the
$ cd /
3 command. Let’s put this into action and see how cool this command can be. It helps you save a ton of time while navigating in the filesystem.

My present working directory is root [/]. If you’re following along, yours should be same, or you can find out yours by issuing

$ cd /home
6. Let’s
$ cd /
3 to another directory:

$ cd /home/kc/0/1/2/3/4/5/6/7/8/9
$ pwd
/home/kc/0/1/2/3/4/5/6/7/8/9

To navigate back to your home directory, simply issue

$ cd /home
0 with the
$ cd /
3 command:

$ cd ~

Again, check your present working directory with the

$ cd /home
6 command:

$ pwd
/home/kc

The dash [

$ cd ~
3] navigates back to the previous working directory, similar to how you can navigate to your user home directory with
$ cd /home
0. If you need to go back to our deeply nested directory
$ cd ~
5 under your user home directory [this was my previous working directory], you would issue this command:

$ cd –

Image

Wrapping up

These commands are your navigation tools inside the Linux filesystem. With what you learned here, you can always find your way to the home [~] directory. If you want to learn more and master the command line, check out 10 basic Linux commands.

Want to try out Red Hat Enterprise Linux? Download it now for free.

Topics:   Linux  

Keerthi Chinthaguntla

Keerthi is aspiring Cloud, DevOps engineer, he has been working with Windows and Linux systems. He believes in continuous learning [CL] and continuous sharing [CS], on his way building his very own CL CS pipeline. When he is not playing in the CLI, you will find him playing Cricket.  More about me

Red Hat Summit 2022: On Demand

Get the latest on Ansible, Red Hat Enterprise Linux, OpenShift, and more from our virtual event on demand.

Register for free

Related Content

Image

Learn how Unix influenced Linux, understand Ansible lists and dictionaries, and more tips for sysadmin

Check out Enable Sysadmin's top 10 articles from November 2022.

Posted: December 5, 2022

Author: Vicki Walker [Editorial Team, Red Hat]

Image

6 ways to get information about your CPU on Linux

Getting insight into what CPU you're running is a useful trick to know.

Posted: December 5, 2022

Author: Seth Kenlon [Editorial Team, Red Hat]

Image

Find anything you need with fzf, the Linux fuzzy finder tool

I'm thankful for the Linux fuzzy finder tool because it superpowers the command line by making it fast to find whatever I'm looking for.

What is the full path to the directory that contains user data for all standard users on the system?

The file-system directory that contains application data for all users. A typical path Windows is C:\ProgramData . The file-system directory that contains files and folders that appear on the desktop for all users. A typical path is C:\Users\Public\Desktop .

Which directory is used to store files representing attached devices?

The /dev/ Directory. The /dev/ directory contains file system entries which represent devices that are attached to the system. These files are essential for the system to function properly.

What standard directory contains system logs?

Most log files are located in the /var/log/ directory. Some applications such as httpd and samba have a directory within /var/log/ for their log files.

Which Linux directory holds program files that are critical for normal operation?

/boot Directory This is one of the most vital directories in a Linux system. As the name infers, the boot directory contains Linux boot files such as the bootloader, the kernel, and its associated files. Files such as 'vmlinuz' represent the compressed image of the Linux kernel.

Chủ Đề