Lecture 2 - Command line environment

IIT Madras - B.S. Degree Programme
21 Dec 202127:59

Summary

TLDRThis session introduces the command line environment, emphasizing its importance for fully leveraging Linux's capabilities and automating tasks through scripting. It covers various terminal emulators like Terminal, xterm, Guake, and Console, and explains basic commands such as pwd, ls, ps, and uname. The presenter also delves into the Linux file system hierarchy, explaining the purpose of directories like /bin, /boot, /dev, and /etc, and how understanding this structure aids in navigating and managing files securely and efficiently.

Takeaways

  • πŸ’» **Command Line Power**: The command line allows users to fully leverage Linux's capabilities and automate tasks through scripting.
  • πŸ”§ **Customization and Flexibility**: Terminal emulators like 'terminal' on Ubuntu offer customization options, while others like 'xterm' are more basic.
  • πŸ”‘ **Accessibility and Activation**: 'Guake' is a unique terminal emulator that can be activated and deactivated with a keyboard shortcut, providing quick access.
  • πŸ“ **Navigating the Environment**: The 'pwd' command is essential for identifying the present working directory, typically the user's home directory upon login.
  • πŸ“ **Listing and Locating Files**: 'ls' is used to list directory contents, with options like '-a' to reveal hidden files and '-l' for detailed listings.
  • πŸ› οΈ **Shell Interaction**: 'ps' helps identify running processes, often revealing the shell being used, such as 'bash', and 'uname' to check the operating system.
  • πŸ—‘οΈ **Screen Management**: Commands like 'clear' or 'Ctrl+L' are used to clear the terminal screen for better readability.
  • ⏏️ **Exiting the Shell**: 'exit' or 'Ctrl+D' can be used to exit the shell, ending the session.
  • πŸ“š **Manual Pages**: 'man' provides access to manual pages for command help, with options to specify sections for more detailed information.
  • πŸ—ƒοΈ **File System Hierarchy**: Understanding the Linux file system hierarchy is crucial for navigating and managing files and directories effectively.

Q & A

  • Why is learning about the command line environment important?

    -Learning about the command line environment is important because it allows users to utilize Linux to its fullest extent, combine commands to form scripts, and automate tasks within the Linux environment.

  • What are some terminal emulators mentioned in the script?

    -The script mentions several terminal emulators including Terminal on Ubuntu, xterm, guake, and console, which is available for the KDE environment.

  • How can one clear the screen in the command line environment?

    -One can clear the screen in the command line environment by typing the command 'clear' or pressing 'Control + L'.

  • What does the 'pwd' command do in the command line?

    -The 'pwd' command stands for 'print working directory' and it shows the present working directory, which is the directory where the user is currently located.

  • What is the purpose of the 'ls' command?

    -The 'ls' command is used to list the names of all the folders or files that are in the current directory.

  • How can you check the processes running in the shell?

    -You can check the processes running in the shell by using the 'ps' command, which lists the currently running processes.

  • What does the 'uname' command display?

    -The 'uname' command displays the name of the operating system that is currently being used.

  • How can you exit the shell in the command line?

    -You can exit the shell by typing the 'exit' command or by pressing 'Control + D'.

  • What is the significance of the command prompt in the command line?

    -The command prompt is significant as it indicates that the shell is ready to accept commands. It typically shows the user's current location in the file system hierarchy.

  • What does the 'ls -a' command display and why is it useful?

    -The 'ls -a' command displays all files in the current directory, including hidden files that start with a dot (.). It is useful for viewing files that are typically not shown by default.

  • What is the file system hierarchy standard mentioned in the script?

    -The file system hierarchy standard mentioned is version 3.0, which is followed by all Linux operating systems, providing a consistent structure for file and directory organization.

Outlines

00:00

πŸ’» Introduction to Command Line Environment

The speaker introduces the command line environment, emphasizing its importance for fully utilizing Linux. They highlight the ability to combine commands into scripts for automation. The video showcases various terminal emulators, such as the Terminal app on Ubuntu, xter, guake, and console, each with different customization features. The speaker demonstrates how to use the command prompt, clear the screen, and navigate the file system using commands like 'pwd', 'ls', and 'uname'. The session aims to help users understand the command line as a tool for both instruction and automation.

05:02

πŸ” Exploring Basic Commands and Shell Interaction

This section reviews the commands covered in the session, such as 'pwd' for the present working directory, 'ls' for listing files, 'ps' for viewing processes, and 'uname' for the operating system. The speaker explains how to clear the screen and exit the shell using 'clear', 'control L', 'exit', and 'control D'. They delve into the anatomy of a command prompt, discussing how it can be configured and the significance of each element. The paragraph concludes with a detailed look at the 'ls' command and its options, including 'ls -a' for all files and 'ls -l' for long format listings, and introduces the concept of manual pages for command help.

10:05

πŸ—‚οΈ Understanding the Linux File System Hierarchy

The speaker explains the importance of understanding the Linux file system hierarchy, which is standardized across all Linux variants. They discuss the purpose of the file system hierarchy, such as locating commands and library files, and how it aids in program development and debugging. The video provides a basic overview of the file system structure, starting from the root directory and explaining the significance of special files like '.' and '..'. The speaker demonstrates how to navigate the file system using 'cd' and explores various directories and their purposes, such as 'bin', 'boot', 'dev', 'etc', 'lib', 'media', 'mnt', 'opt', 'run', 'sbin', 'srv', 'tmp', 'user', and 'var'.

15:06

πŸ“ Navigating Directories and Understanding File Types

This segment focuses on navigating the Linux file system and understanding the organization of directories as per the file system hierarchy standard. The speaker discusses the role of directories like 'bin', 'boot', 'dev', 'etc', 'lib', and 'media', explaining their contents and purposes. They also touch upon the difference between symbolic links and actual directories, as well as the distinction between character and block devices. The video illustrates how to use 'ls -l' to view file details and how to interpret the output, including recognizing directories, links, and device files.

20:11

πŸ› οΈ Deep Dive into System Directories and Their Functions

The speaker provides a detailed exploration of system directories, their functions, and the rationale behind their organization. They discuss the contents of 'etc', 'var', 'dev', 'lib', and other directories, explaining the types of files found in each and their significance in the system. The video also covers the concepts of shareable and non-shareable directories, static and variable file systems, and the logic behind the Linux file system hierarchy. The speaker encourages users to explore the command line environment to become familiar with the file system and locate files efficiently.

25:16

πŸ”š Wrapping Up and Encouraging Exploration

In the concluding part, the speaker summarizes the key points discussed in the video, including the file system hierarchy and the importance of understanding it for efficient navigation and file management. They reiterate the purpose of various directories and the types of files they contain, emphasizing the need for users to explore and familiarize themselves with the command line environment. The speaker encourages further exploration and practice to gain comfort and proficiency in using the Linux file system.

Mindmap

Keywords

πŸ’‘Command Line Environment

The command line environment, also known as the command line interface (CLI), is a text-based system used to interact with the computer's operating system. It allows users to type commands to execute programs, manage files, and perform various tasks without the use of a graphical user interface (GUI). In the video, the command line environment is central to the discussion as it is presented as a powerful tool for utilizing Linux to its fullest extent, enabling automation and efficient task management.

πŸ’‘Script

A script in the context of the command line environment refers to a sequence of commands written in a programming language like Bash, which can be executed by the shell. Scripts are used to automate tasks by running a series of commands in a specific order. The video emphasizes the importance of scripts in automating tasks within the Linux environment, showcasing how they can be launched at specific times to perform routine operations.

πŸ’‘Terminal Emulator

A terminal emulator is a program that simulates a video terminal within other environments, such as a window in a GUI. It provides access to the command line environment. The video mentions several terminal emulators, including 'terminal' on Ubuntu, 'xterm', and 'guake', highlighting their different features and capabilities, such as flexibility in controlling font size and colors, or the ability to open multiple tabs.

πŸ’‘Command Prompt

The command prompt is a symbol or string displayed by the shell in the terminal emulator, indicating that it is ready to accept commands from the user. It serves as a visual cue for the user to begin typing commands. The video script describes the command prompt as a starting point for typing commands, with examples showing how it changes based on the current directory and user permissions.

πŸ’‘Shell

The shell in a Linux environment is a program that provides a command-line interface for interacting with the operating system's kernel. It is responsible for interpreting user commands and executing them. The video script mentions 'bash' (Bourne Again SHell) as the shell that is being used, which is a common choice known for its scripting capabilities and compatibility with older scripts.

πŸ’‘File System Hierarchy

The file system hierarchy refers to the organizational structure of directories and files in a Linux operating system. It is standardized to ensure consistency across different Linux distributions. The video script explains the importance of understanding this hierarchy for navigating the system, locating files, and managing resources effectively. It also provides an overview of the standard directories such as '/bin', '/etc', and '/home'.

πŸ’‘Home Directory

The home directory is the default directory for a user on a Linux system, where personal files and settings are stored. It is represented by the '~' symbol. The video script mentions that when a user logs in, they are placed in their home directory, which is a key starting point for file management and navigation within the file system.

πŸ’‘Symbolic Link

A symbolic link, often referred to as a 'symlink', is a type of file that serves as a reference to another file or directory. In the video script, symbolic links are mentioned in the context of the '/bin' directory, which may be a symlink to a directory in '/user/bin', illustrating how it can provide a convenient way to access files without navigating through the entire file system hierarchy.

πŸ’‘Device Files

Device files in Linux represent hardware devices and are treated as special files within the '/dev' directory. They allow user-space programs to interact with hardware devices in a file-like manner. The video script explains that these files are crucial for system operations, as they enable the reading and writing of data to and from devices, such as reading a character by character from a terminal.

πŸ’‘Configuration Files

Configuration files are text files that store settings for applications or system services. They are typically located in the '/etc' directory in Linux systems. The video script discusses the role of configuration files in customizing the behavior of services and applications, emphasizing their importance in system administration and user environment setup.

Highlights

Command line environment is essential for utilizing Linux to its fullest extent.

Combining commands into scripts allows for task automation in the Linux environment.

Terminal emulators like 'terminal' on Ubuntu provide flexibility in customization.

Guake is a terminal emulator that can be activated and deactivated with the F12 key.

The command prompt is the interface for typing commands into the shell.

The 'pwd' command shows the present working directory in the file system.

The 'ls' command lists the contents of the current directory.

The 'ps' command lists the processes running in the current shell.

The 'uname' command displays the operating system in use.

The 'clear' command or CTRL+L can be used to clear the terminal screen.

The 'exit' command or CTRL+D can be used to exit the shell.

The anatomy of a command includes the command prompt, user name, host name, and current path.

The 'ls -a' option lists all files, including hidden ones.

The 'ls -l' option displays files in long format, showing more detailed information.

The 'man' command provides access to manual pages for command help.

The file system hierarchy standard (FHS) is followed by all Linux distributions for consistency.

Understanding the file system hierarchy is crucial for navigating and managing files in Linux.

The root directory ('/') is the starting point of the file system hierarchy.

The 'cd' command is used to change directories, navigating the file system hierarchy.

Special directories like '/bin', '/boot', and '/dev' have specific roles as defined by FHS.

The '/media' directory is for removable devices, and '/tmp' is for temporary files.

The '/home' directory contains user-specific data and is the default location after login.

The '/etc' and '/var' directories contain configuration and variable data, respectively.

Exploring the file system hierarchy helps in locating files needed for program execution and development.

The file system hierarchy is designed to be shareable and static or variable as needed.

The command line environment empowers users to efficiently manage and utilize the Linux operating system.

Transcripts

play00:14

Welcome to the introductory session on command line environment.

play00:18

Why would we want to learn about command line environment?

play00:21

Because when we are able to type out commands then we are capable of using Linux to its

play00:30

fullest extent.

play00:31

We can combine these commands to form a script and then we can use these scripts to be launched

play00:38

at specific times and thereby automate some of the tasks that we would like to do using

play00:44

the Linux environmentt.

play00:45

So, the command line environmentt should be seen as not only a way by which you type out

play00:53

instructions to the computer but also as a path towards automation.

play00:58

On the screen you are noticing there are two apps that are giving you the command line

play01:05

environment.

play01:06

My favorite would be the app called terminal on Ubuntu genome environment it has flexibility

play01:15

to control the font size the colours etcetera.

play01:18

It also can open multiple tabs as I am showing you here.

play01:23

There is another terminal emulator called xter which is here you can see and it does

play01:30

not have many of those features to customize the appearance.

play01:35

And a third terminal emulator would be ~~quick~~ guake which we activate by pressing the key

play01:42

F12 and by pressing it again we can actually deactivate.

play01:47

Once you install it and run it once then it would be in the background listening to your

play01:52

command and you can open it or close it at your wish.

play01:55

There is another terminal emulator called console which is available for the KDE environment

play02:01

on Ubuntu as well as other Linux variant.

play02:05

For most of the session we will actually look at the terminal app which is acting as a terminal

play02:12

emulator for us.

play02:13

Let me maximize the window so that we can see the commands clearly.

play02:18

Now what you are seeing on the screen here is called the command prompt.

play02:22

So, if you just keep pressing the enter key then you will see that the shell is asking

play02:29

you for some input and it is prompting you for that by showing this string and this string

play02:35

is called as the command prompt.

play02:38

And you can actually know clear the screen by typing the command clear and the cursor

play02:45

will be taken to the top of the window.

play02:47

Now one of the first things that we must do when we open a command line environment is

play02:52

to check where are we with respect to the files system, pwd is a command to show you

play02:59

the present working director and normally you will see that you are in the home directory.

play03:05

When you first login and open the thermal environment you will be placed in the home

play03:11

directory of that particular user you are logged into.

play03:15

In this case the home directory slash home slash user name which is what is configured

play03:20

for this particular account.

play03:23

The next thing that we normally do is to type ls which is to list the names of all the folders

play03:29

or files that are in this current directory.

play03:32

And you would see that there are certain folders available as part of the genome environment

play03:39

desktop documents downloads pictures videos etcetera.

play03:45

And you want to know what shell is actually responding to our commands, you may want to

play03:50

list the processes that are running right now and you would notice that there is a bash

play03:56

that is running.

play03:57

So, our shell that we are interacting with using this terminal emulator is bash shell.

play04:04

There are many other shells that we will come to that in a moment and what operating system

play04:09

are we using that you could actually know by typing the command uname and let us say

play04:16

we run many such commands and we would like to clear the screen we could type the command

play04:22

clear and press enter and the entire display will be clear.

play04:27

You could also for example type a command and the press control l to also clear the

play04:33

screen and after you have played around a bit you want to exit what you would do is

play04:39

type the command exit to come out of the shell.

play04:44

Alternatively you can also press control d.

play04:47

So, I can now press control d and come out of the shell we have an extent that is running

play04:54

in the background we would like to come out of that.

play04:56

So, we would type exit and then come out of that.

play05:01

And when I press F12 I am opening the ~~quack~~ guake terminal and you could of course you

play05:08

can exit from that also but when you press F12 again another shell is actually shown

play05:13

to you.

play05:14

And I can run the same commands there and get the same output irrespective of the shell

play05:21

or the terminal emulator the commands that you are sending are being responded from the

play05:28

operating system.

play05:30

Now let us suggest to wrap up what we have discussed till now.

play05:33

So, what have we been doing now.

play05:36

So, what we did was we opened a terminal emulator and most of the things we did was on terminal

play05:43

app and we ran some commands pwd present working directory ~~tells~~, ls to list the folders

play05:50

are files in the directory, ps to look at the processes that are running in that particular

play05:55

shell, uname to look at what is the operating system, that is actually responding.

play06:00

So, these are the some of the commands that we started off and if you were able to clear

play06:05

the screen by pressing control L and also come out of the shell by pressing control

play06:09

D.

play06:12

Now if you look at what we have been doing there is command prompt that is there and

play06:18

then there is a command that we have written.

play06:19

So, let us look at the anatomy of the spiritual command.

play06:23

So, you see that when we write a command the command prompt in front of the command has

play06:31

many portions which can be configured separately we will discuss about that when we come to

play06:37

the variable called ps1.

play06:39

For now you see that the command prompt has the user name and then an ~~ad~~ at symbol

play06:46

after that the name of the machine followed by a colon and then the path where the command

play06:53

is being executed and then a dollar to signal that from then onwards you can actually start

play06:59

typing and the comment that we typed is ls and sometimes for some of the commands we

play07:05

need to give some options and here is an example ls -a.

play07:09

So, let us look at how this comment would look like.

play07:15

Now let us look at these commands a little more in detail.

play07:21

So, we have type command ls to look at what all the files that are in the current directory.

play07:27

We can actually now give an option to that command, I would give an option -a.

play07:32

So, most of the Linux options would have hyphen or a minus sign in front of them and you would

play07:39

see that there are a lot more files are being displayed.

play07:42

So, by this -a option will list files which also have dot in front of them which means

play07:50

that those are basically hidden from the user for routine operation.

play07:55

So, if you press ls you would see the files that are used by the user in a routine manner

play08:01

and -a if you give as an option then ls would give you the hidden files also which are having

play08:08

a dot in the first possession of the name.

play08:13

And if you press ls -l the list of files is displayed in a different manner this is called

play08:19

the ~~long~~ long format and we will discuss these fields in detail in a moment.

play08:29

You can get help on any command in the Linux thanks to the manual pages that come bundled

play08:37

along with the operating system.

play08:40

And you can pass on any command name as an argument to the command man and then get help

play08:47

on it.

play08:48

So, let us ask for a manual page on the command ls and you can see the help for the ls command

play08:56

you can read this to expand the scope of how the ls command would work for you.

play09:02

The most frequent options that are used with ls are ls -a to list all the files and ls

play09:09

-l to list the files in a long format.

play09:14

So, here is what we have done we have run the command man with the argument ls.

play09:20

So, that we are looking at the manual page for the ls command to understand various options

play09:27

that can go along with the ls command.

play09:30

Now the manual pages come in many sections and this is just a textbook information to

play09:35

let you know that the manual pages cover various aspects of the operating system and the section

play09:41

one is where the shell commands are being described.

play09:45

So, you can actually ask man pages to be displayed in the section one for the command ls.

play09:52

So, here what happens is that when you type man space 1 space ls, 1 becomes an option

play09:58

and ls becomes an argument.

play10:00

Let us explore the file system of a Linux operator system.

play10:04

Luckily for us the file system hierarchy standard version 3.0 is what is followed by all the

play10:13

Linux opening systems irrespective of the variant that we are using.

play10:16

So, we are using the Ubuntu 20.04 lts version and you could shift to another version of

play10:25

Linux and you would see that the folders will have the same name and they will be located

play10:30

in the same hierarchy as we will be exploring shortly.

play10:33

Why do we need to understand how the file system hierarchy is?

play10:37

The reason is that when we log to the system and when we open a command line environment

play10:44

in a shell we are placed at a particular location in the hierarchy namely our home directory

play10:50

and we have permissions to create files in that directory and perhaps also in some other

play10:55

directory such as slash temp but we do have read access to many files that are there in

play11:01

several folders and we should be able to traverse the hierarchy.

play11:05

And locate commands corresponding to specific applications that we would like to run and

play11:13

very often we need to identify the right location of a library file because it is required for

play11:19

some compilation of a program.

play11:21

The files corresponding to libraries are header files to compile our codes and the ability

play11:29

to traverse the file system hierarchy will actually determine how soon we are able to

play11:34

debug our difficulties with respect to compilation requirement and get on with the program development.

play11:41

So, it is very useful to familiarize ourselves with file system hierarchy of Linux.

play11:46

So, here is a sample of the file system hierarchy the forward slash or slash simply is the root

play11:57

directory and that is a starting point for the file system hierarchy.

play12:01

This character forward slash is also used as a field separator to indicate the path

play12:08

to any directory.

play12:10

As we see now let us say for example we want to refer to this directory called bin which

play12:14

is under directly called user then you would write that part for this bin as slash user

play12:21

slash bin.

play12:23

And you would see that there are a number of directories with specific names which will

play12:28

actually have their meaning as described in the file system hierarchy standard 3.0.

play12:35

The user directory is here the home directory for a user and under the home directory there

play12:40

are folders which are created by the operating system while creating that account and there

play12:45

are also folders that the user can create for herself or himself.

play12:51

We can explore the file system hierarchy by first understanding how to actually construct

play12:58

the path of any directory.

play13:00

So, forward slash is the root of the file system and also the ~~delivered~~ delimeter

play13:03

for the subdirectories.

play13:05

And in every directory there are two special files one is called the dot which is referring

play13:12

to the current director and the other is double dot which is referring to the parent directory.

play13:18

So, if you type the command cd space dot nothing will happen because you are trying to change

play13:24

the directory to the current directory.

play13:25

So, there is no change in the directly position.

play13:28

If you type the command cd space double dot then you are going one level up in the file

play13:35

system hierarchy.

play13:36

So, you could ~~travel~~ traverse the file system hierarchy up and down by changing the

play13:42

directory.

play13:43

If you want to go from the user's home directory upwards you would say cd space double dot

play13:48

and then you would be home directly and then series double dot you will be in the root

play13:52

directory.

play13:53

From the root directory if you actually give the absolute path you could actually go anywhere

play13:58

you wish or you could actually use a cd with the name of the directory to traverse one

play14:03

level at a time.

play14:05

Let us explore the file system hierarchy using the system where we are trying to demonstrate

play14:11

I become an environment.

play14:13

So, where am I right now?

play14:16

I am in the home directory of the user I am logged into and when I type ls I see that

play14:22

there are certain files that are listed ~~herw~~ here and when I press ls space -a then we

play14:31

notice that there are two special files here one that is dot and another that is double

play14:37

dot.

play14:38

There is a special directory called double dot which is allowing us to traverse one level

play14:42

up in the hierarchy.

play14:43

So, let me change my ~~director~~ directory to one level up and you would now see that

play14:50

we are now in slash home.

play14:52

And if I type this ~~comment~~ command once more then we are in the root folder verify

play14:57

that we are in the root folder using the pwd command.

play15:01

Now if I press cd then we are going back to the home ~~director~~ directory which means

play15:06

that the cd without any arguments will take you to the home directory.

play15:09

I know press control l clear the screen.

play15:12

Now let me go back to the root folder and using ls we will see that there are certain

play15:20

folders that are there in the root folder an get the -l option we can actually see the

play15:29

long format and it actually indicates several things about the file system that we can already

play15:35

start getting familiarized.

play15:36

For example the very first character shows that there is an l here and for some directories

play15:42

it is d and the difference between these two is that the l indicates a symbolic link.

play15:49

So, which means that the bin folder of the root ~~territory~~ directory is actually a

play15:54

symbolic link to a folder with the same name in the user directory and the d here means

play16:02

that it is actually a directory by itself in the particular location.

play16:05

Now boot directory the Linux kernel is located which is what gets executed when the system

play16:13

is starting up and there are many such directors here let us explore one of them.

play16:19

So, we will go to the user directory and then from there we can go down to the bin director

play16:27

and let us look at what are the files that are there?

play16:29

There is a lot of files that are here and many of these are actually commands that we

play16:35

would be using as we go along learning the command line and environment and we can now

play16:43

go back to the home directory verify that we are in the home directory.

play16:49

In this manner we can actually traverse the hierarchy of the file system and explore what

play16:55

is there in which folder.

play16:57

Now let us look at the organization of these folders as per the file system hierarchy standard.

play17:03

The bin directory in the root folder should contain the essential command binaries or

play17:08

executables.

play17:09

These are the commands that every user in the system are supposed to be able to run.

play17:15

Sometimes this folder can be a link to the folder in slash user slash bin and that is

play17:21

a matter of only a choice from the company that packages the Linux for you.

play17:27

Boot folder contains the boot order which is what executes when system starts.

play17:32

Dev folder contains the device file.

play17:36

One says that in Linux everything is a file.

play17:39

So, every device that is corrected to the computer is actually a file as far as the

play17:44

representation is concerned in the file system hierarchy.

play17:48

Etc folder contains configurations of various services which are specific to that particular

play17:54

machine.

play17:55

The lib folder will contain the libraries are shared programs as well as kernel modules.

play18:02

The media folder will contain folders which are created when you insert a removable device

play18:08

into the computer.

play18:09

For example if you insert a usb disk then in the media folder a folder is available

play18:15

this will contain the file system for the usb stick which you can explore and when you

play18:20

unbound or eject the usb stick then that folder will also disappear.

play18:26

Now slash mnt is a folder where you could have mount points that is directories which

play18:32

are made available to traverse the file system of those respective hardware or hard disk.

play18:39

Slash opt is a folder where application software packages are installed particularly in high

play18:46

performance computing environment.

play18:50

Run is a file system to have the data for the running processes.

play18:55

Sbin is a directory where the executables meant for system administration are kept.

play19:02

It is expected that normal users in the routine operation of the system do not require to

play19:07

execute any command which is located in this particular folder, srv is a folder that contains

play19:15

the data for ftp or http services, tmp is a folder where temporary files are located

play19:22

every user will have permission to write files to this particular folder.

play19:27

And one should not expect such files to be available after the rebooting because in many

play19:33

computers the configuration would be such that upon reporting the slash time will be

play19:39

cleaned up.

play19:40

Slash user is a secondary hierarchy for the file system which is shareable by that we

play19:45

mean when you have a high performance computing environment then you could have the user directory

play19:53

shared across multiple computers.

play19:54

So, that you do not have to actually have that much of hard disk uh space replicated

play20:00

across all the computer.

play20:03

Slash var is a folder where variable data is stored such as the log files for various

play20:10

system services that are running in the background.

play20:13

Now let us come back to the command prompt and look at these directories.

play20:17

So, we go back to the root folder and you see that there is user directory and in that

play20:23

there is a bin directory and you have got all these commands.

play20:28

And we also noticed the slash etc.

play20:30

So, look at what is all there in slash etc you would see that a whole bunch of files

play20:35

are named as dot ~~con~~ conf which is basically the configuration for those respective ~~surfaces~~

play20:41

services.

play20:43

And slash var is a folder where we said that the log files will be located and they are

play20:48

all in this folder called log and you would see that there are logs that are created for

play20:55

various services.

play20:59

Now let us look at the slash dev folder and you would see that the display would have

play21:05

a different character in the long format of the file listing.

play21:10

The c here shows that it is actually a character file which means that you could read from

play21:16

that particular device a character by character which is typical of ~~uh~~ devices such as

play21:21

the terminal.

play21:23

And there are some files which would actually have the first character as b and these are

play21:28

called as block devices particularly it is for the hard disks.

play21:32

So, when you want to read from a hard disk you would read one block at a time typically

play21:37

a block would be either 512 bytes or 1 kilobyte or even 4 kilobytes depending upon the configuration

play21:44

and the Linux typically it is one kilobyte.

play21:47

So, if you see these devices which are listed as sda 1 up to 7 these are block devices which

play21:54

are available as files as far as the file system is concerned.

play22:01

Let us look at the slash lib folder and you will see that this folder would contain many

play22:09

files that would have a pattern which would have a number in the end which is typical

play22:14

of a library files with version numbers that are there as a part part of the file name.

play22:18

You can now explore the file system at your convenience and as long as you are using the

play22:24

commands like cd and ls there is nothing that you can go wrong and make yourself familiar

play22:30

with the file system hierarchy and understand which part of the hierarchy is your home directory

play22:37

and everything below that hierarchy is what is owned and writable for you.

play22:42

So, you could actually play around with it.

play22:45

And you will notice that you cannot actually do much changes to the file system hierarchy

play22:50

beyond your home directory which is characteristic of the secure manner by which the file system

play22:56

is configured in the Linux operating system.

play22:58

Before we wrap up let us look at the hierarchy of the user and var folders which is quite

play23:05

extensive.

play23:06

So, in the user hierarchy the secondary hierarchy you would have a user bin folder which will

play23:12

contain commands that every user is expected to be able to run.

play23:17

And there is a folder called user lib where library files are located, user local is a

play23:23

directly where certain applications which are specific for that particular system are

play23:29

installed which may not be common for all the operator systems in that particular variant.

play23:36

User sbin is ~it directly~ a directory where system administration executables are located

play23:41

but these are non vital because the vital ones are available in slash sbin itself.

play23:46

What do we mean by that?

play23:48

It is that when the machine is in a single user mode or in maintenance mode then executables

play23:56

which are required to mount the file systems are performed system administration tasks

play24:01

that are not dependent on any network or any remotely located file systems that are mounted

play24:10

on the system then you would actually use uh slash sbin.

play24:13

User share is a folder where the architecture dependent data is stored.

play24:23

User include is a directory where the header files for C programs are all to be found.

play24:28

So, when you started the helloworld program in C for example stdio dot h is a header file

play24:35

that you include and you would see that it is located in this particular folder.

play24:40

User src would be containing the source code of various applications that are installed

play24:44

on the Linux operating system if you have chosen to installed those package.

play24:49

The var hierarchy is also important because we need to know where to find the log files.

play24:58

So, in var log the log files for various services will be located and in var temp some of the

play25:05

temporary files that are to be preserved between the reports will be locate.

play25:10

And vr log is a place where the log files are there for processes which would like to

play25:16

have exclusive access to certain files during certain operations that prevent any clash

play25:23

of information, var lib is a variable state information.

play25:27

Now here is some logic or reason why there are such folders with this kind of a hierarchy.

play25:35

So, what we mean by a shareable folder is that a file system which can be shared across

play25:42

computers this is essentially to conserve the storage and also to provide uniform uh

play25:48

file system to multiple computers particularly in high performance computing environment.

play25:55

And sometimes you also have what is called the static and variable kind of file systems

play26:01

or directories.

play26:02

The static ones are ones which do no during the regular operation of the computer whereas

play26:08

variable ones would change.

play26:10

For example when an email comes a folder corresponding to that particular users inbox would change.

play26:16

So, that would be in the variable folder such as var by mail by the user name.

play26:21

However when you execute commands the executables are not going to change and they will always

play26:27

static files there are some folders which cannot be shared across computers because

play26:32

they contain configuration specific to that particular computer.

play26:36

Slash etc and slash put are some such folders and there are some such folders which are

play26:42

not shareable across computers as well as they are also variable with the regular operation

play26:47

of the computer like for example var lock or var run

play26:51

So, this is a logic why there are different folders and a standard has been defined to

play26:59

ensure that users who log into machines can actually identify these folders irrespective

play27:05

of the specific version of the operating system they are using.

play27:10

And across the Linux variance you would find that the file system hierarchy is maintained.

play27:16

And this helps us navigate the file system hierarchy and locate the files that we are

play27:23

looking for to execute them or to use them for linking purpose while we compare some

play27:28

of our programs.

play27:29

I hope you got a sense of the file system hierarchy and I urge you to explore the command

play27:36

line environment and make yourself familiar with the file system of your own computer.

play27:43

And you would soon be comfortable with locating files that would arrive onto your computer

play27:47

as you run commands or download things and move around the files for your work.

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
LinuxCommand LineAutomationFile SystemTerminalScriptsBash ShellNavigationUbuntuSystem Administration