0% found this document useful (0 votes)
19 views12 pages

Unixnew 2

The document discusses the key features and structure of the Unix file system. It begins with an introduction explaining that the Unix file system is a logical method for organizing and storing information in a hierarchical tree structure with directories and files. It then provides descriptions of important directories like /, /bin, /boot, /dev, /etc, and others. It also discusses commands like pwd, cd, mkdir, and rmdir used to navigate and manage the file system. Key advantages of the Unix file system are its hierarchical organization and robustness, while disadvantages include complexity and a steep learning curve.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views12 pages

Unixnew 2

The document discusses the key features and structure of the Unix file system. It begins with an introduction explaining that the Unix file system is a logical method for organizing and storing information in a hierarchical tree structure with directories and files. It then provides descriptions of important directories like /, /bin, /boot, /dev, /etc, and others. It also discusses commands like pwd, cd, mkdir, and rmdir used to navigate and manage the file system. Key advantages of the Unix file system are its hierarchical organization and robustness, while disadvantages include complexity and a steep learning curve.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

MODULE 2 UNIX FILE SYSTEM

UNIT 2
THE UNIX FILE SYSTEM

INTRODUCTION:

Unix file system is a logical method of organizing and storing large amounts of information in a
way that makes it easy to manage. A file is a smallest unit in which the information is stored.
Unix file system has several important features. All data in Unix is organized into files. All files
are organized into directories. These directories are organized into a tree-like structure called the
file system. Files in Unix System are organized into multi-level hierarchy structure known as a
directory tree. At the very top of the file system is a directory called “root” which is represented
by a “/”. All other files are “descendants” of root.
The Unix file system is a hierarchical file system used by Unix-based operating systems to store
and organize files and directories. It is a tree-like structure that starts with a single directory
called the root directory, which is denoted by a forward slash (/) character.

Dept of CSE, BrCE 1


MODULE 2 UNIX FILE SYSTEM

Directories or Files and their description –


• / : The slash / character alone denotes the root of the filesystem tree.
• /bin : Stands for “binaries” and contains certain fundamental utilities, such as ls or
cp, which are generally needed by all users.
• /boot : Contains all the files that are required for successful booting process.
• /dev : Stands for “devices”. Contains file representations of peripheral devices and
pseudo-devices.
• /etc : Contains system-wide configuration files and system databases. Originally
also contained “dangerous maintenance utilities” such as init,but these have typically
been moved to /sbin or elsewhere.
• /home : Contains the home directories for the users.
• /lib : Contains system libraries, and some critical files such as kernel modules or
device drivers.
• /root : The home directory for the superuser “root” – that is, the system
administrator. This account’s home directory is usually on the initial filesystem, and
hence not in /home (which may be a mount point for another filesystem) in case
specific maintenance needs to be performed, during which other filesystems are not
available. Such a case could occur, for example, if a hard disk drive suffers physical
failures and cannot be properly mounted.
• /tmp : A place for temporary files. Many systems clear this directory upon startup;
it might have tmpfs mounted atop it, in which case its contents do not survive a reboot,
or it might be explicitly cleared by a startup script at boot time.
• /usr/bin : This directory stores all binary programs distributed with the operating
system not residing in /bin, /sbin or (rarely) /etc.
• /usr/include : Stores the development headers used throughout the system. Header
files are mostly used by the #include directive in C/C++ programming language.
• /usr/lib : Stores the required libraries and data files for programs stored within /usr
or elsewhere.

Dept of CSE, BrCE 2


MODULE 2 UNIX FILE SYSTEM

Advantages of the Unix file system include:

1. Hierarchical organization: The hierarchical structure of the Unix file system makes it
easy to organize and navigate files and directories.
2. Robustness: The Unix file system is known for its stability and reliability. It can
handle large amounts of data without becoming unstable or crashing.

Disadvantages of the Unix file system include:

1. Complexity: The Unix file system can be complex to understand and manage,
especially for users who are not familiar with the command line interface.
2. Steep learning curve: Users who are not familiar with Unix-based systems may find
it difficult to learn how to use the Unix file system.
PRINT WORKING DIRECTORY (pwd):

pwd command

pwd stands for Print Working Directory. It prints the path of the working directory, starting
from the root. pwd is shell built-in command(pwd) or an actual binary(/bin/pwd). $PWD is
an environment variable that stores the path of the current directory.
Syntax of `pwd` command in Linux
$ pwd [OPTIONS]

Dept of CSE, BrCE 3


MODULE 2 UNIX FILE SYSTEM

THE HOME DIRECTORY:

A home directory, also called a login directory, is the directory on Unix-like operating
systems that serves as the repository for a user's personal files, directories and programs.

• The simplest of these is to use the cd (i.e., change directory) command without any options
or arguments (i.e., input files), i.e., by merely typing the following and then pressing the
ENTER key:

ls command:

$cd

• The tilde (the wavy horizontal line character) is used to represent users' home directories on
Unix-like operating systems, including users' home directories that are used to store web pages
on Unix-like web servers. Thus, a user could also return to its home directory by using the tilde
as an argument to cd, i.e. $ cd

Dept of CSE, BrCE 4


MODULE 2 UNIX FILE SYSTEM

• The absolute pathname of a user's home directory is stored in that user's


$HOME environmental variable. Environmental variables are a class of variables that tell
the shell (i.e., the program that provides the text-only user interface for entering commands)
how to behave as a user works at the command line (i.e., all-text mode). Thus a third way for
a user to return to its home directory is to use $HOME as an argument to cd, i.e.,

cd $HOME

Dept of CSE, BrCE 5


MODULE 2 UNIX FILE SYSTEM

ABSOLUTE PATHNAME:

An absolute pathname, also referred to as an absolute path or a full path, is the location of
a filesystem object (i.e., file, directory or link) relative to the root directory.

The absolute pathname of the current directory can be found by using the pwd command, which
accepts no arguments (i.e., input data) and is usually used without options, i.e.

$ pwd

1.cd:

cd command in Linux known as the change directory command. It is used to move


efficiently from the current working directory to different directories in our System.
Syntax of the `cd` command in Linux
$ cd [directory]
For Example:
If we want to move to a subdirectory name “Documents”
Command:
$ cd Documents

Dept of CSE, BrCE 6


MODULE 2 UNIX FILE SYSTEM

• Using `/` as an argument in `cd` command in Linux


By using `/` as an argument in `cd` we can change the directory to the root directory.
The root directory is the first directory in your filesystem hierarchy.
Command:
$ cd /

Above, / represents the root directory. and used `pwd` to check the current location path
or we can say current directory name.
In above snapshot the root contains all the subfolders like afs, dev,bin , lib etc.

1. mkdir:

mkdir command in Linux allows the user to create directories (also referred to as folders
in some operating systems). This command can create multiple directories at once as well
as set the permissions for the directories. It is important to note that the user executing
this command must have enough permission to create a directory in the parent directory,
or he/she may receive a ‘permission denied’ error.

Dept of CSE, BrCE 7


MODULE 2 UNIX FILE SYSTEM

Syntax:
$ mkdir [options...] [directories ...]

For example:

If we want to create a directory name “somesh_gfg”.

command
$ mkdir Sushmitha._gfg

Options available in mkdir


–help:
It displays help-related information and exits.

Dept of CSE, BrCE 8


MODULE 2 UNIX FILE SYSTEM

command:
$ mkdir –help

• –version:

It displays the version number, some information regarding the license and exits.
command:

$ mkdir –version

Dept of CSE, BrCE 9


MODULE 2 UNIX FILE SYSTEM

2. rmdir:

The rmdir command is useful when you want to remove the empty directories from the
filesystem in Linux. This command lets you specify the terminal to remove a particular
directory right from the terminal.
rmdir <options> <directory>

rmdir command is similar to the rm command, but rmdir only removes empty directories.

for example if we want to remove the file folder1 which is present then we use the
command:

$ rmdir folder1

$ ls

• --help:

we will use the help flag to list down all the available options for the rmdir command:\

$ rmdir –help

Dept of CSE, BrCE 10


MODULE 2 UNIX FILE SYSTEM

$ rmdir –help

• –version:
This option displays the version information and exit.
$ rmdir –version

Dept of CSE, BrCE 11


MODULE 2 UNIX FILE SYSTEM

RELATIVE PATHNAME:

A relative pathname contrasts with an absolute pathname in that it tells the location of a filesystem
object relative to the current directory (i.e., the directory in which the user is currently working)
rather than from the root directory.

Unlike the absolute path that starts from the root directory, the relative paths start from the present
working directory. Thus, the relative path changes depending on your current directory.

*For example, if I am in portfolio and want to change to sushmitha I can do this with a cd command
followed by the relative pathname between portfolio like this (first using pwd to show where I
am): cd ../.. where .. is used to move back to parent directory.

Dept of CSE, BrCE 12

You might also like