Difference between revisions of "Linux-Ubuntu/C2/File-System-in-Linux/English"
Ketkinaina (Talk | contribs) (Created page with "'''Title of the Script: File System''' '''in Linux''' '''Author: EduPyramids Team.''' '''Keywords: '''Linux, terminal, file, directories, pwd, ls command, cat command, video...") |
|||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 6: | Line 6: | ||
'''Prerequisite tutorial: General Purpose Utilities''' | '''Prerequisite tutorial: General Purpose Utilities''' | ||
| + | |||
{|border=1 | {|border=1 | ||
| Line 12: | Line 13: | ||
|| '''Narration''' | || '''Narration''' | ||
|- | |- | ||
| − | || '''Slide | + | || '''Slide 1''' |
| + | |||
| + | '''Title Slide''' | ||
|| Welcome to this''' Spoken tutorial '''on''' File System''' '''in Linux'''. | || Welcome to this''' Spoken tutorial '''on''' File System''' '''in Linux'''. | ||
|- | |- | ||
| − | || '''Slide 2 Learning Objectives ''' | + | || '''Slide 2''' |
| + | |||
| + | '''Learning Objectives ''' | ||
|| In this tutorial we will learn to: | || In this tutorial we will learn to: | ||
* Define Files, directories and inode. | * Define Files, directories and inode. | ||
| Line 35: | Line 40: | ||
To follow this tutorial, | To follow this tutorial, | ||
| − | Learners should know the basics of using the | + | Learners should know the basics of using the Linux terminal. |
For the prerequisite Linux tutorials please visit | For the prerequisite Linux tutorials please visit | ||
| Line 52: | Line 57: | ||
# '''fs-commands.txt''' | # '''fs-commands.txt''' | ||
| − | This file is provided in the Code Files link of this tutorial page. | + | This file is provided in the '''Code Files''' link of this tutorial page. |
|| The following code file is required to practice this tutorial. | || The following code file is required to practice this tutorial. | ||
| − | This file is provided in the Code Files link of this tutorial page. | + | This file is provided in the '''Code Files''' link of this tutorial page. |
|- | |- | ||
|| | || | ||
| Line 65: | Line 70: | ||
* In real life, a file is used to store documents and papers. | * In real life, a file is used to store documents and papers. | ||
* Similarly, in '''Linux''', a file is a container used to store information. | * Similarly, in '''Linux''', a file is a container used to store information. | ||
| − | || Now let us understand what a file is?In '''Linux''' almost everything is treated as a file. | + | || Now let us understand what a file is? |
| + | |||
| + | In '''Linux''' almost everything is treated as a file. | ||
In real life, a file is used to store documents and papers. | In real life, a file is used to store documents and papers. | ||
| Line 85: | Line 92: | ||
'''inode''' | '''inode''' | ||
| − | |||
| − | |||
'''inode.png''' | '''inode.png''' | ||
| Line 107: | Line 112: | ||
A directory does not store files directly. | A directory does not store files directly. | ||
| − | It is a file that maps file names to their corresponding inode numbers. | + | It is a file that maps file names to their corresponding '''inode''' numbers. |
|- | |- | ||
|| '''Slide 9''' | || '''Slide 9''' | ||
| Line 113: | Line 118: | ||
'''Linux File System hierarchy''' | '''Linux File System hierarchy''' | ||
| − | '''Linux-filesystem.png | + | '''Linux-filesystem.png''' |
|| All the files are connected in a tree structure. | || All the files are connected in a tree structure. | ||
| Line 130: | Line 135: | ||
# '''Regular files : '''They store data as a stream of characters. | # '''Regular files : '''They store data as a stream of characters. | ||
| − | For example: text files, images, videos | + | For example: text files, images, videos. |
# '''Directories: '''Organize files and other directories. | # '''Directories: '''Organize files and other directories. | ||
# '''Device files: '''These represent hardware such as disks, USBs, Cds. | # '''Device files: '''These represent hardware such as disks, USBs, Cds. | ||
| Line 139: | Line 144: | ||
Press''' Ctrl, Alt '''and''' T keys '''on your''' keyboard''' | Press''' Ctrl, Alt '''and''' T keys '''on your''' keyboard''' | ||
| − | || Let us now open the '''terminal '''window. | + | || Let us now open the '''terminal ''' window. |
|- | |- | ||
|| '''Type pwd ''' | || '''Type pwd ''' | ||
| Line 148: | Line 153: | ||
|| By default we are always in the home directory. | || By default we are always in the home directory. | ||
| − | Let me type '''pwd '''and press '''Enter'''. | + | Let me type '''pwd ''' and press '''Enter'''. |
| − | The output shows '''/home/spoken '''as the present working directory. | + | The output shows '''/home/spoken ''' as the present working directory. |
|- | |- | ||
|| Type''' ls -l '''and press '''Enter'''. | || Type''' ls -l '''and press '''Enter'''. | ||
| Line 158: | Line 163: | ||
* List of all files with file permissions, | * List of all files with file permissions, | ||
* file owner's name, | * file owner's name, | ||
| − | * file size in bytes | + | * file size in bytes, |
* last modification time, | * last modification time, | ||
| − | * File or directory name | + | * File or directory name. |
|- | |- | ||
|| Point to the information on the terminal. | || Point to the information on the terminal. | ||
| Line 168: | Line 173: | ||
'''ls -l >fileinfo''' and press '''Enter'''. | '''ls -l >fileinfo''' and press '''Enter'''. | ||
| − | || So type '''ls space hyphen l space greater than fileinfo''' and | + | || So type '''ls space hyphen l space greater than fileinfo''' and press''' Enter'''. |
Observe that nothing is displayed on the screen. | Observe that nothing is displayed on the screen. | ||
| Line 177: | Line 182: | ||
|| To see the content of the files we have to use '''cat''' command. | || To see the content of the files we have to use '''cat''' command. | ||
| − | So type '''cat space fileinfo '''and | + | So type '''cat space fileinfo '''and press''' Enter'''. |
Output shows the file contents. | Output shows the file contents. | ||
| Line 188: | Line 193: | ||
It can also be used to create or append files. | It can also be used to create or append files. | ||
| − | Type '''cat space greater than file1 dot | + | Type '''cat space greater than file1 dot txt '''and''' '''press''' Enter.''' |
|- | |- | ||
|| Type '''I am creating a new file.''' and press Enter. | || Type '''I am creating a new file.''' and press Enter. | ||
| Line 234: | Line 239: | ||
|| Let us now learn to create directories. | || Let us now learn to create directories. | ||
| − | To create a directory I will type '''mkdir space test1 '''and press '''Enter | + | To create a directory I will type '''mkdir space test1 '''and press '''Enter'''. |
If no output appears it means that the command has executed successfully. | If no output appears it means that the command has executed successfully. | ||
| Line 287: | Line 292: | ||
Let me type '''cd space dot dot slash dot dot slash''' | Let me type '''cd space dot dot slash dot dot slash''' | ||
| − | |||
| − | |||
Here the first two dots move up one level. | Here the first two dots move up one level. | ||
| Line 314: | Line 317: | ||
This indicates that if the directory is not empty it cannot be deleted. | This indicates that if the directory is not empty it cannot be deleted. | ||
| − | A directory must be empty before it can be removed using''' rmdir'''. | + | A directory must be empty before it can be removed using ''' rmdir'''. |
|- | |- | ||
|| | || | ||
| Line 342: | Line 345: | ||
'''Thank you''' | '''Thank you''' | ||
| − | || This Spoken Tutorial is brought to you by EduPyramids Educational Services Private Limited SINE IIT Bombay.Thank you. | + | || This Spoken Tutorial is brought to you by EduPyramids Educational Services Private Limited SINE IIT Bombay. |
| + | |||
| + | Thank you. | ||
|- | |- | ||
|} | |} | ||
Latest revision as of 15:54, 16 January 2026
Title of the Script: File System in Linux
Author: EduPyramids Team.
Keywords: Linux, terminal, file, directories, pwd, ls command, cat command, video tutorial, EduPyramids.
Prerequisite tutorial: General Purpose Utilities
| Visual Cue | Narration |
| Slide 1
Title Slide |
Welcome to this Spoken tutorial on File System in Linux. |
| Slide 2
Learning Objectives |
In this tutorial we will learn to:
|
| Slide 3
System Requirements |
To record this tutorial, I am using,
Ubuntu OS version 24 point 04. |
| Slide 4
Pre-requisites To follow this tutorial, Learners should know the basics of using the Linux terminal. For the prerequisite Linux tutorials please visit |
To follow this tutorial,
|
| Slide 5
Code files The following code file is required to practice this tutorial
This file is provided in the Code Files link of this tutorial page. |
The following code file is required to practice this tutorial.
This file is provided in the Code Files link of this tutorial page. |
| Let us discuss files and directories. | |
| Slide 6
Files
|
Now let us understand what a file is?
In Linux almost everything is treated as a file. In real life, a file is used to store documents and papers. Similarly, in Linux, a file is a container used to store information. |
| Slide 7
Directory
|
Let us now see what a directory is?
A directory is a collection of files and other sub-directories. A directory helps us organize our files in a systematic manner. |
| Slide 8
inode inode.png |
Every file has its own properties.
It has a name, creation, modification time and permission. These properties are stored in a structure called inode. An inode is a data structure identified by a unique number. It is used by the system to identify a file. It stores information about a file such as size, permissions, and ownership. It also stores timestamps and the disk location of the file. File name is only for human convenience. A directory does not store files directly. It is a file that maps file names to their corresponding inode numbers. |
| Slide 9
Linux File System hierarchy Linux-filesystem.png |
All the files are connected in a tree structure.
At the top of this tree is the root directory indicated by slash(/). Every file and directory exists under root(/). |
| Slide 10
Types of Files types-of-files1.png |
Types of files in Linux.
Linux has three main types of files:
For example: text files, images, videos.
They can be read and written like files. |
| Screencast:
Press Ctrl, Alt and T keys on your keyboard |
Let us now open the terminal window. |
| Type pwd
Point to the output /home/spoken |
By default we are always in the home directory.
Let me type pwd and press Enter. The output shows /home/spoken as the present working directory. |
| Type ls -l and press Enter. | Now type ls space hyphen l and press Enter.
Terminal shows the following output.
|
| Point to the information on the terminal. | Instead of displaying all information on the screen, we can store it in a file. |
| Type at the prompt
ls -l >fileinfo and press Enter. |
So type ls space hyphen l space greater than fileinfo and press Enter.
Observe that nothing is displayed on the screen. |
| Type at the prompt
cat fileinfo and press Enter. |
To see the content of the files we have to use cat command.
So type cat space fileinfo and press Enter. Output shows the file contents. |
| Type at the prompt
cat > file1.txt and press Enter. |
The cat command is mainly used to display file contents.
It can also be used to create or append files. Type cat space greater than file1 dot txt and press Enter. |
| Type I am creating a new file. and press Enter.
Press Ctrl + D keys to end the input. |
After pressing Enter, the command waits for input from the user.
So let’s type I am creating a new file. and press Enter. Whatever we type will be written into the file. The input is ended by pressing Ctrl and D keys together. |
| Type at the prompt
cat >>file1.txt and press Enter. |
If you wish to append to the end of an existing file type
cat space greater than greater than file1 dot txt and press Enter. |
| Type at the prompt
This is a new line in the file. and press Enter. Press Ctrl + D keys together. |
Again the command waits for input from the user.
So type, This is a new line in the file. and press Enter. Press Ctrl and D keys together to end the input. |
| Type: cat file1.txt and press Enter. | To see the contents written in file1 type,
cat space file1 dot txt and press Enter. |
| Type: clear and Press Enter. | Type clear to clear the terminal window. |
| Type: mkdir test1 and Press Enter.
While recording, show the directory creation in the home directory. Place the terminal and home directory side-by-side. |
Let us now learn to create directories.
To create a directory I will type mkdir space test1 and press Enter. If no output appears it means that the command has executed successfully. |
| Type mkdir test2 test3 and press Enter | Let us now create multiple directories.
So I will type mkdir space test2 space test3 and press Enter. |
| Type mkdir -p test4/test4.1 and press Enter.
Show the folders test4 and test4.1 Highlight -p. |
Now to show the directory hierarchy let me type mkdir space hyphen p space test4 slash test4 point 1 and press Enter.
This will create a directory test4 point 1 within the test4 directory. Here the argument hyphen p creates parent directories if they do not already exist. Then test4 point 1 directory is created inside test4. |
| Now let us learn to move into various directories. | |
| Type: cd test1 press Enter. | Type cd space test1 and press Enter.
We are now in the test1 directory. |
| Type cd .. and press Enter. | Let us go back to the parent directory.
So type cd space dot dot |
| Type: cd test press Tab keys twice .
Press the backspace key to erase the prompt. |
Now type cd test and press the Tab key twice.
All the directories with the name test will be displayed. Press the backspace key to erase the prompt. |
| Type cd test4/test4.1 and press Enter. | Type cd test4/test4 point 1 and press Enter to move to test4 point 1. |
| Type: cd ../../
Press the Enter key. |
Now let us learn to do multi-level navigation to come back to the home directory.
Let me type cd space dot dot slash dot dot slash Here the first two dots move up one level. Second two dots moves up one more directory level. Press the Enter key. |
| Type: rmdir test1 and press Enter. | Now we will learn to delete the created test 1 directory.
Type rmdir space test1 and press Enter. Now, we can see that the test1 directory is removed. |
| Type: rmdir test4 test4/test4.1
Highlight the output: rmdir: failed to remove 'test4': Directory not empty |
Type rmdir space test4 space test4 slash test4 point 1.
The output shows rmdir: failed to remove 'test4': Directory not empty. This indicates that if the directory is not empty it cannot be deleted. A directory must be empty before it can be removed using rmdir. |
| With this we come to the end of this tutorial. | |
| Slide 9
Summary In this tutorial we have learn to:
|
Let us summarise. |
| Slide 10
Assignment
|
As an assignment, please do the following. |
| Slide 11
Thank you |
This Spoken Tutorial is brought to you by EduPyramids Educational Services Private Limited SINE IIT Bombay.
Thank you. |