Linux Basics

10 / 87
The Directory Structure
   

A file is kept inside a directory. A directory can have a file or another directory inside it. It is like an inverted tree.

The top level directory is "/" called root. "/" directory does not have a parent. /A/B means B is inside A which is inside top level directory "root".

File System

List Files and Directory

To see the list of files use the command: ls

Relative & Absolute Paths - Change the Directory

There are two ways to represent a file/directory path:

Absolute: This way of representing a file/directory is independent of current directory of the user. Such paths start with "/". Examples: /etc/passwd.

Relative: Relative to current working directory. Examples: ../../etc/passwd

You can change directory using "cd" command. Every user is given a separate home directory.

Home Directory & Current Directory

Inside the console, you are always in a directory. On login, by default, you land in your home directory.

To see the present working directory use: pwd

To change the directory to your home directory use only cd command without any arguments.