Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
6 views3 pages

Ch-2 File Hierarchy Lecture Notes

The document outlines the Linux file system hierarchy, detailing the purpose of various directories such as /boot, /home, and /etc. It also explains how to create soft and hard links using the 'ln' command, along with their advantages and disadvantages. Additionally, it covers searching for strings in files using the 'grep' command and introduces wildcard and brace expansions for file management.

Uploaded by

Shivangi Tiwary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Ch-2 File Hierarchy Lecture Notes

The document outlines the Linux file system hierarchy, detailing the purpose of various directories such as /boot, /home, and /etc. It also explains how to create soft and hard links using the 'ln' command, along with their advantages and disadvantages. Additionally, it covers searching for strings in files using the 'grep' command and introduces wildcard and brace expansions for file management.

Uploaded by

Shivangi Tiwary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Ch-2

File system Hierarchy = its a filesystem of a linux which we get after listing / by
ls / command

1) /boot = stores boot related files also kernel files are stored in this folder.
vmlinuz version
2) /dev = device related files are stored here for example cpu, had disk , keyboard
,mouse ,printer etc
3) /home = all regular user's home directory files are stored here.
4) /root = it is home directory for root user.
5) /etc = all configuration files are stored in this directory.
6) /tmp = all temporary files are stored in thi directory, also all user has full
permission in this folder as they can create files and folders in this directory.
7) /usr/bin = all binary files of regular user's command are stored in this
directory.
8) /usr/sbin = all binary files of super user's command are stored in this
directory.
9) /usr/lib & /usr/lib64 = all library files are stored in this directory of 32 bit
as well as 64bit
10) /media = cdrom or removable devices such as pendrive related files are stored
in this directory.
11) /mnt = mount related files are stored in this directory.
12) /run = runtime data such as logs are generated in this directory. it has only
current data.
13) /var = variable data = it stores data from run folder permananetly specifically
logs.

..= previous directory


.= current directory
cd = u will redirected to home directory.

Ch-2 Lecture -2
--> Make Links between Files <--

1) Soft Link ( symbolic Link )


2) Hard Link

--> to create link "ln" command is used.

1) Soft Link ( Symbolic Link): it used to create shotcuts like windows for easy
access of files and directories. it is also called as Symbolic Link.

syntax: ln -s source file path symbolic link path

--> Dangling softlink: If source file or directory's path is changed somehow or the
source gets deleted than the soft link of that source file which was created
starting to give an error and colour coded as Red instead of SkyBlue.

2) Hard Link

Syntax :- ln "source file path" "hardlink path"

-->Advantage: if source file's location is changed or it gets deleted somehow still


we get backup of that file in hardlink.

--> Disadvantage:
No hard link is allowd for directory.
--> to identify hardlink we need to verify its "inode number" with its source file.

-->inode number: a specific number which is created when any file or directory or
any resource is created in Linux/.
--> two files or directories are said to be same if inode numbers of both files or
directories are same.

--> How to check inode number:


Syntax ls -i

CH-2 LECT-3

topic -1 -->Match File Names with Shell Expansions

topic -2 --> search string

--> search string: when we have to search some keyword from any file we user search
string command

--> the command used for search string is "grep"

--> syntax : grep keyword file path

--> options:
1) grep -i = it ingnores whether keyword is capital or not
2) grep -v keyword = it will print the whole content by excluding keyword.

--> wildcard: symbols such as !@#$%^&*? are used in linux for their specific
purpose is called wildcards

1) $ keyword/alphabet/number = system will consider that the keyword or alphabet or


number is "ending with"
2) ^ = carrot symbol --> when we have mention that something is starting from
3) * = to find including keyword
4) ? = it denotes a single character
5) ! = when we have to exclude something

-->Match File Names with Shell Expansions


see in book

--> Brace exapansion {}

when we have to mention range then we will user {} example we have too create
files from 1 to 20 file1.txt file2.txt file3.txt ---> file 20.txt

command touch file{1..20}.txt


task:
1) create a folder in /root/grep-practice and inside that folder create filename
Document1-Document30.doc
2)Search String starting with word "comp" from /usr/share/dict/words
3)search string with exact word "dog" from /usr/share/dict/words
4) practice grep

You might also like