How To Access Directories in Linux UNIX COmmand Line.

How To Access Directories in Linux UNIX COmmand Line.

As a beginner to Ubuntu finding directories can be daunting. Here I give a step by step guide on how to locate the DocumentRoot of your apache webpage

For users new to Linux, making use of the command-line interface can be terribly frustrating. Especially if you are trying to find directories where your dependencies are stored like apache, python, etc.

When I first started development with a Linux server from my Windows cmd it took me 45 precious minutes to figure out how to get into the directory holding my DocumentRoot for the webpage I was building.

A lot of the articles I saw online were not explanatory enough so I decided to write this to help you spend less time looking for directories. In this article, I will give you a step-by-step guide on how to access your directories and read their content.

Step 1: Make sure you are in your source directory.

First directory.jpg

When you log into your Linux server, the command line shows the current directory you are working from. To e sure you are in your user directory (source directory), use the CD command to go back to the source directory. From here you can navigate into any directory you want to work with.

Step 2: CD into the /var directory

Using the cd command, navigate into the var directory. This directory holds your cached files, backup, etc but most importantly it holds the www directory that contains the DocumentRoot of your page.

cd /var >>> moves you into the var directory

ls >>> displays a list of all directories and files in the var directory.

Step 3: The DocumentRoot is contained in the /var/www/html directory.

Navigate to the www/Html/ directory and voila welcome to the document root. To read the files contained in the directory, use the LESS command. To edit the files, you need a text editor that works in the command line like; Vim, Emacs, etc.

Hope this was helpful. Stay jiggy.