SlideShare a Scribd company logo
Chapter 3
File Management
Keep this in mind!Keep this in mind!
●
File is everything.File is everything.
●
Everything is file!Everything is file!
Directory TreeDirectory Tree
●
Everything starting from the root (/)Everything starting from the root (/)
directory .directory .
●
Directory itself is a file, contains a list for subDirectory itself is a file, contains a list for sub
directories and files.directories and files.
Linux Filesystem HierarchyLinux Filesystem Hierarchy
Directory ExpressionDirectory Expression
●
Root directory:Root directory: //
●
Working directory:Working directory: ././
●
Parent directory:Parent directory: ../../
●
Home directory:Home directory: ~, ~user~, ~user
FHS Data TypesFHS Data Types
●
Filesystem Hierarchy Standard (FHS)Filesystem Hierarchy Standard (FHS)
defines two categories of data use, eachdefines two categories of data use, each
with two opposing subtypeswith two opposing subtypes
– Data sharingData sharing
●
SharableSharable
●
Non-sharableNon-sharable
– Data modificationData modification
●
VariableVariable
●
StaticStatic
Ref. Pge. 208
FHS Data TypesFHS Data Types
ShareableShareable Non-ShareableNon-Shareable
VariableVariable
/home/home
/var/mail/var/mail
/var/run/var/run
/var/lock/var/lock
StaticStatic
/usr/usr
/opt/opt
/boot/boot
/etc/etc
Path NamePath Name
●
Path is the way to find a file location inPath is the way to find a file location in
the directory tree.the directory tree.
●
Path TypesPath Types
– Absolute Path:Absolute Path: /path/to/a/file/path/to/a/file
●
It is unique, ignoring working directoryIt is unique, ignoring working directory
●
Must starting with /Must starting with /
– Relative Path:Relative Path: path/to/afilepath/to/afile
●
It is vary, depends on working directoryIt is vary, depends on working directory
●
No / preceding, same as starting with ./No / preceding, same as starting with ./
Directory Related CommandsDirectory Related Commands
●
pwdpwd
– Display the absolute path of current workingDisplay the absolute path of current working
directorydirectory
●
lsls
– List directory contentList directory content
●
cdcd
– Change working directoryChange working directory
Common Options ofCommon Options of lsls
●
­a­a
List all files including hidden file (startingList all files including hidden file (starting
with .)with .)
●
­l­l
List file information in long formatList file information in long format
●
­d­d
List the directory name instead of contentList the directory name instead of content
●
­r­r
Recursively list all sub directoriesRecursively list all sub directories
Ref. Pge. 178
File CreationFile Creation
●
mkdir <sub_dir>mkdir <sub_dir>
– Create a new directoryCreate a new directory
●
touch <file_name>touch <file_name>
– Create a new empty fileCreate a new empty file
– Change time stamps of an existing fileChange time stamps of an existing file
File DeletionFile Deletion
●
rmdir <empty_dir>rmdir <empty_dir>
– Remove a directoryRemove a directory
– Directory must be emptyDirectory must be empty
●
rm <file_name>rm <file_name>
– Remove a fileRemove a file
– Common options:Common options:
●
-r : remove directory recursively-r : remove directory recursively
●
-i : confirm before deletion-i : confirm before deletion
File CopyingFile Copying
●
cp <origin_file> <new_file>cp <origin_file> <new_file>
– Existing destination will be overwrittenExisting destination will be overwritten
– Multiple files can be copied into an existingMultiple files can be copied into an existing
directorydirectory
– Common optionsCommon options
●
-i : confirm before overwriting-i : confirm before overwriting
●
-r : copying directory-r : copying directory
File MovingFile Moving
●
mv <origin_file> <new_file>mv <origin_file> <new_file>
– Existing destination will be overwrittenExisting destination will be overwritten
– Multiple files can be moved into an existingMultiple files can be moved into an existing
directorydirectory
– Rename a file within the same directoryRename a file within the same directory
– Common optionsCommon options
●
-i : confirm before overwriting-i : confirm before overwriting
File LinkingFile Linking
●
ln <origin_file> <new_name>ln <origin_file> <new_name>
– Hard link, referring a file by multiple namesHard link, referring a file by multiple names
– Increase 1 in link counterIncrease 1 in link counter
●
ln ­s <origin_file> <new_name>ln ­s <origin_file> <new_name>
– Symbolic(Soft) link, referring a file by pathSymbolic(Soft) link, referring a file by path
– No increase in link counterNo increase in link counter
Ref. Pge. 190
UsingUsing findfind
●
find [dir] [option] [action]find [dir] [option] [action]
– Locate files in the file systemLocate files in the file system
– Starting from working directory if noStarting from working directory if no
directory specifieddirectory specified
Ref. Pge. 212
Common Options ofCommon Options of findfind
●
­name 'file_name' ­name 'file_name' : file name: file name
●
­size <n>[­size <n>[bbckw] ckw]  : file size: file size
­n ­n  : less then n: less then n
+n +n  : greater then n: greater then n
n  n   : equal to n: equal to n
●
­mtime <n>­mtime <n> : modification time (n=24hr): modification time (n=24hr)
●
­perm <perm>­perm <perm> : permission: permission
●
­user <user>­user <user> : user name: user name
●
­group <gropu>­group <gropu> : group name: group name
Common Actions ofCommon Actions of findfind
●
­print­print : print to STDOUT (default): print to STDOUT (default)
●
­exec cmd {} ; ­exec cmd {} ; : use results as: use results as
arguments of commandarguments of command
●
­ok cmd {} ; ­ok cmd {} ; : same as -exec, with: same as -exec, with
confirmationconfirmation
UsingUsing locatelocate
●
locate <path_name>locate <path_name>
– List file location information extracted fromList file location information extracted from
the locatedb which contains all file paths inthe locatedb which contains all file paths in
the systemthe system
– The locatedb is updated by the updatedb
command
Ref. Pge. 213
File Type DeterminationFile Type Determination
●
file <path_name>file <path_name>
– Show the file type.Show the file type.
Command LocationCommand Location
●
whereis <command_name>whereis <command_name>
– Show all available location of a commandShow all available location of a command
Ref. Pge. 214
Command SourceCommand Source
●
which <command_name>which <command_name>
– Show the exact command to run if no specificShow the exact command to run if no specific
path givenpath given
Command Type DeterminationCommand Type Determination
●
type <command_name>type <command_name>
– Show the actual type of a commandShow the actual type of a command
– Common command types:Common command types:
●
InternalInternal
●
ExternalExternal
●
AliasAlias
●
FunctionFunction

More Related Content

What's hot

Ha opensuse
Ha opensuseHa opensuse
Ha opensuse
Kenny (netman)
 
Logical volume manager xfs
Logical volume manager xfsLogical volume manager xfs
Logical volume manager xfs
Sarwar Javaid
 
Comparison of-foss-distributed-storage
Comparison of-foss-distributed-storageComparison of-foss-distributed-storage
Comparison of-foss-distributed-storage
Marian Marinov
 
Linux
LinuxLinux
1.2 boot the system v2
1.2 boot the system v21.2 boot the system v2
1.2 boot the system v2
Acácio Oliveira
 
Archlinux install
Archlinux installArchlinux install
Archlinux install
sambismo
 
Encoding errors
Encoding errorsEncoding errors
Encoding errors
zeu1507
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common Command
Jeff Yang
 
Unix for Librarians
Unix for LibrariansUnix for Librarians
Unix for Librarians
Ravi Mynampaty
 
PostgreSQL + ZFS best practices
PostgreSQL + ZFS best practicesPostgreSQL + ZFS best practices
PostgreSQL + ZFS best practices
Sean Chittenden
 
Part 03 File System Implementation in Linux
Part 03 File System Implementation in LinuxPart 03 File System Implementation in Linux
Part 03 File System Implementation in Linux
Tushar B Kute
 
Linux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of TechnologyLinux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of Technology
Nugroho Gito
 
3.3 perform basic file management
3.3 perform basic file management3.3 perform basic file management
3.3 perform basic file management
Acácio Oliveira
 
101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems
Acácio Oliveira
 
The Linux Command Cheat Sheet
The Linux Command Cheat SheetThe Linux Command Cheat Sheet
The Linux Command Cheat Sheet
Tola LENG
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
Acácio Oliveira
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
Acácio Oliveira
 

What's hot (20)

Ha opensuse
Ha opensuseHa opensuse
Ha opensuse
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
Logical volume manager xfs
Logical volume manager xfsLogical volume manager xfs
Logical volume manager xfs
 
Comparison of-foss-distributed-storage
Comparison of-foss-distributed-storageComparison of-foss-distributed-storage
Comparison of-foss-distributed-storage
 
Linux
LinuxLinux
Linux
 
1.2 boot the system v2
1.2 boot the system v21.2 boot the system v2
1.2 boot the system v2
 
Archlinux install
Archlinux installArchlinux install
Archlinux install
 
Encoding errors
Encoding errorsEncoding errors
Encoding errors
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common Command
 
Unix for Librarians
Unix for LibrariansUnix for Librarians
Unix for Librarians
 
Basic Linux day 2
Basic Linux day 2Basic Linux day 2
Basic Linux day 2
 
PostgreSQL + ZFS best practices
PostgreSQL + ZFS best practicesPostgreSQL + ZFS best practices
PostgreSQL + ZFS best practices
 
Part 03 File System Implementation in Linux
Part 03 File System Implementation in LinuxPart 03 File System Implementation in Linux
Part 03 File System Implementation in Linux
 
Linux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of TechnologyLinux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of Technology
 
3.3 perform basic file management
3.3 perform basic file management3.3 perform basic file management
3.3 perform basic file management
 
Raj linux
Raj linux Raj linux
Raj linux
 
101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems
 
The Linux Command Cheat Sheet
The Linux Command Cheat SheetThe Linux Command Cheat Sheet
The Linux Command Cheat Sheet
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
 

Viewers also liked

Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkg
Kenny (netman)
 
Importance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingImportance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation reading
Kenny (netman)
 
About the Course
About the CourseAbout the Course
About the Course
Kenny (netman)
 
SNMP & The Dark Side of the Force
SNMP & The Dark Side of the Force SNMP & The Dark Side of the Force
SNMP & The Dark Side of the Force
Coastal Pet Products, Inc.
 
Linux: Beyond ls and cd
Linux: Beyond ls and cdLinux: Beyond ls and cd
Linux: Beyond ls and cdjacko91
 
Linux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procLinux fundamental - Chap 08 proc
Linux fundamental - Chap 08 proc
Kenny (netman)
 
Windows7 Vs Linux
Windows7 Vs LinuxWindows7 Vs Linux
Windows7 Vs Linux
Yogesh Gandhi
 
Linux CLI
Linux CLILinux CLI
The linux command line for total beginners
The linux command line  for total beginnersThe linux command line  for total beginners
The linux command line for total beginners
Corrie Watt
 
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxLinux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regx
Kenny (netman)
 
Linux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viLinux fundamental - Chap 07 vi
Linux fundamental - Chap 07 vi
Kenny (netman)
 
Inter as vpn option c
Inter as vpn option c Inter as vpn option c
Inter as vpn option c
Goerge Micheal Gerges
 
Snmp
SnmpSnmp
Linux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterLinux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filter
Kenny (netman)
 
Linux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementLinux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account management
Kenny (netman)
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentals
chakrikolla
 
Linux files
Linux filesLinux files
Linux files
Geeta Vinnakota
 
Nagios Conference 2013 - William Leibzon - SNMP Protocol and Nagios Plugins
Nagios Conference 2013 - William Leibzon - SNMP Protocol and Nagios PluginsNagios Conference 2013 - William Leibzon - SNMP Protocol and Nagios Plugins
Nagios Conference 2013 - William Leibzon - SNMP Protocol and Nagios Plugins
Nagios
 
Linux files and file permission
Linux files and file permissionLinux files and file permission
Linux files and file permissionU.P Police
 
Part 4 final
Part 4 finalPart 4 final
Part 4 final
abdullaaqil
 

Viewers also liked (20)

Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkg
 
Importance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingImportance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation reading
 
About the Course
About the CourseAbout the Course
About the Course
 
SNMP & The Dark Side of the Force
SNMP & The Dark Side of the Force SNMP & The Dark Side of the Force
SNMP & The Dark Side of the Force
 
Linux: Beyond ls and cd
Linux: Beyond ls and cdLinux: Beyond ls and cd
Linux: Beyond ls and cd
 
Linux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procLinux fundamental - Chap 08 proc
Linux fundamental - Chap 08 proc
 
Windows7 Vs Linux
Windows7 Vs LinuxWindows7 Vs Linux
Windows7 Vs Linux
 
Linux CLI
Linux CLILinux CLI
Linux CLI
 
The linux command line for total beginners
The linux command line  for total beginnersThe linux command line  for total beginners
The linux command line for total beginners
 
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxLinux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regx
 
Linux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viLinux fundamental - Chap 07 vi
Linux fundamental - Chap 07 vi
 
Inter as vpn option c
Inter as vpn option c Inter as vpn option c
Inter as vpn option c
 
Snmp
SnmpSnmp
Snmp
 
Linux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterLinux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filter
 
Linux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementLinux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account management
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentals
 
Linux files
Linux filesLinux files
Linux files
 
Nagios Conference 2013 - William Leibzon - SNMP Protocol and Nagios Plugins
Nagios Conference 2013 - William Leibzon - SNMP Protocol and Nagios PluginsNagios Conference 2013 - William Leibzon - SNMP Protocol and Nagios Plugins
Nagios Conference 2013 - William Leibzon - SNMP Protocol and Nagios Plugins
 
Linux files and file permission
Linux files and file permissionLinux files and file permission
Linux files and file permission
 
Part 4 final
Part 4 finalPart 4 final
Part 4 final
 

Similar to Linux fundamental - Chap 03 file

Learning Linux v2.1
Learning Linux v2.1Learning Linux v2.1
Learning Linux v2.1sdiviney
 
File handling and permisions.pptx
File handling and permisions.pptxFile handling and permisions.pptx
File handling and permisions.pptx
AkampaPhilomena
 
Linux file system nevigation
Linux file system nevigationLinux file system nevigation
Linux file system nevigation
hetaldobariya
 
Managing your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformaticsManaging your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformatics
BITS
 
Management file and directory in linux
Management file and directory in linuxManagement file and directory in linux
Management file and directory in linux
Zkre Saleh
 
Devops for beginners
Devops for beginnersDevops for beginners
Devops for beginners
Vivek Parihar
 
Linux administration training
Linux administration trainingLinux administration training
Linux administration training
iman darabi
 
Linux basics part 1
Linux basics part 1Linux basics part 1
Linux basics part 1
Lilesh Pathe
 
Command Line Tools
Command Line ToolsCommand Line Tools
Command Line Tools
David Harris
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files
Ahmed El-Arabawy
 
File handling in qbasic
File handling in qbasicFile handling in qbasic
File handling in qbasic
SmritiGurung4
 
File Management System in Shell Script.pptx
File Management System in Shell Script.pptxFile Management System in Shell Script.pptx
File Management System in Shell Script.pptx
Green University of Bangladesh
 
Linux 4 you
Linux 4 youLinux 4 you
Linux 4 you
Shashwat Shriparv
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
amitkamble79
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
MeesanRaza
 
14.Linux Command
14.Linux Command14.Linux Command
14.Linux Command
Export Promotion Bureau
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
BITS
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unixsouthees
 

Similar to Linux fundamental - Chap 03 file (20)

Learning Linux v2.1
Learning Linux v2.1Learning Linux v2.1
Learning Linux v2.1
 
File handling and permisions.pptx
File handling and permisions.pptxFile handling and permisions.pptx
File handling and permisions.pptx
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
Linux file system nevigation
Linux file system nevigationLinux file system nevigation
Linux file system nevigation
 
Managing your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformaticsManaging your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformatics
 
Management file and directory in linux
Management file and directory in linuxManagement file and directory in linux
Management file and directory in linux
 
Devops for beginners
Devops for beginnersDevops for beginners
Devops for beginners
 
Linux administration training
Linux administration trainingLinux administration training
Linux administration training
 
Linux basics part 1
Linux basics part 1Linux basics part 1
Linux basics part 1
 
Command Line Tools
Command Line ToolsCommand Line Tools
Command Line Tools
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files
 
File handling in qbasic
File handling in qbasicFile handling in qbasic
File handling in qbasic
 
Basic unix
Basic unixBasic unix
Basic unix
 
File Management System in Shell Script.pptx
File Management System in Shell Script.pptxFile Management System in Shell Script.pptx
File Management System in Shell Script.pptx
 
Linux 4 you
Linux 4 youLinux 4 you
Linux 4 you
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
 
14.Linux Command
14.Linux Command14.Linux Command
14.Linux Command
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 

More from Kenny (netman)

rpi_audio configuration steps
rpi_audio configuration stepsrpi_audio configuration steps
rpi_audio configuration steps
Kenny (netman)
 
Rpi audio
Rpi audioRpi audio
Rpi audio
Kenny (netman)
 
Chap 19 web
Chap 19 webChap 19 web
Chap 19 web
Kenny (netman)
 
Chap 18 net
Chap 18 netChap 18 net
Chap 18 net
Kenny (netman)
 
Linux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueLinux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System Rescue
Kenny (netman)
 
Linux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job SchedulingLinux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job Scheduling
Kenny (netman)
 
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell script
Kenny (netman)
 
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementLinux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware Management
Kenny (netman)
 
Linux fundamental - Chap 11 boot
Linux fundamental - Chap 11 bootLinux fundamental - Chap 11 boot
Linux fundamental - Chap 11 boot
Kenny (netman)
 
Linux fundamental - Chap 00 shell
Linux fundamental - Chap 00 shellLinux fundamental - Chap 00 shell
Linux fundamental - Chap 00 shell
Kenny (netman)
 
Linux system security
Linux system securityLinux system security
Linux system security
Kenny (netman)
 
Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on pratice
Kenny (netman)
 
Linux Network Monitoring
Linux Network MonitoringLinux Network Monitoring
Linux Network Monitoring
Kenny (netman)
 
加密應用(GPG)
加密應用(GPG)加密應用(GPG)
加密應用(GPG)
Kenny (netman)
 
金鑰管理 (PKI)
金鑰管理 (PKI)金鑰管理 (PKI)
金鑰管理 (PKI)
Kenny (netman)
 
Linux firewall
Linux firewallLinux firewall
Linux firewall
Kenny (netman)
 

More from Kenny (netman) (16)

rpi_audio configuration steps
rpi_audio configuration stepsrpi_audio configuration steps
rpi_audio configuration steps
 
Rpi audio
Rpi audioRpi audio
Rpi audio
 
Chap 19 web
Chap 19 webChap 19 web
Chap 19 web
 
Chap 18 net
Chap 18 netChap 18 net
Chap 18 net
 
Linux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueLinux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System Rescue
 
Linux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job SchedulingLinux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job Scheduling
 
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell script
 
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementLinux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware Management
 
Linux fundamental - Chap 11 boot
Linux fundamental - Chap 11 bootLinux fundamental - Chap 11 boot
Linux fundamental - Chap 11 boot
 
Linux fundamental - Chap 00 shell
Linux fundamental - Chap 00 shellLinux fundamental - Chap 00 shell
Linux fundamental - Chap 00 shell
 
Linux system security
Linux system securityLinux system security
Linux system security
 
Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on pratice
 
Linux Network Monitoring
Linux Network MonitoringLinux Network Monitoring
Linux Network Monitoring
 
加密應用(GPG)
加密應用(GPG)加密應用(GPG)
加密應用(GPG)
 
金鑰管理 (PKI)
金鑰管理 (PKI)金鑰管理 (PKI)
金鑰管理 (PKI)
 
Linux firewall
Linux firewallLinux firewall
Linux firewall
 

Recently uploaded

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 

Recently uploaded (20)

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 

Linux fundamental - Chap 03 file

  • 2. Keep this in mind!Keep this in mind! ● File is everything.File is everything. ● Everything is file!Everything is file!
  • 3. Directory TreeDirectory Tree ● Everything starting from the root (/)Everything starting from the root (/) directory .directory . ● Directory itself is a file, contains a list for subDirectory itself is a file, contains a list for sub directories and files.directories and files.
  • 4. Linux Filesystem HierarchyLinux Filesystem Hierarchy
  • 5. Directory ExpressionDirectory Expression ● Root directory:Root directory: // ● Working directory:Working directory: ././ ● Parent directory:Parent directory: ../../ ● Home directory:Home directory: ~, ~user~, ~user
  • 6. FHS Data TypesFHS Data Types ● Filesystem Hierarchy Standard (FHS)Filesystem Hierarchy Standard (FHS) defines two categories of data use, eachdefines two categories of data use, each with two opposing subtypeswith two opposing subtypes – Data sharingData sharing ● SharableSharable ● Non-sharableNon-sharable – Data modificationData modification ● VariableVariable ● StaticStatic Ref. Pge. 208
  • 7. FHS Data TypesFHS Data Types ShareableShareable Non-ShareableNon-Shareable VariableVariable /home/home /var/mail/var/mail /var/run/var/run /var/lock/var/lock StaticStatic /usr/usr /opt/opt /boot/boot /etc/etc
  • 8. Path NamePath Name ● Path is the way to find a file location inPath is the way to find a file location in the directory tree.the directory tree. ● Path TypesPath Types – Absolute Path:Absolute Path: /path/to/a/file/path/to/a/file ● It is unique, ignoring working directoryIt is unique, ignoring working directory ● Must starting with /Must starting with / – Relative Path:Relative Path: path/to/afilepath/to/afile ● It is vary, depends on working directoryIt is vary, depends on working directory ● No / preceding, same as starting with ./No / preceding, same as starting with ./
  • 9. Directory Related CommandsDirectory Related Commands ● pwdpwd – Display the absolute path of current workingDisplay the absolute path of current working directorydirectory ● lsls – List directory contentList directory content ● cdcd – Change working directoryChange working directory
  • 10. Common Options ofCommon Options of lsls ● ­a­a List all files including hidden file (startingList all files including hidden file (starting with .)with .) ● ­l­l List file information in long formatList file information in long format ● ­d­d List the directory name instead of contentList the directory name instead of content ● ­r­r Recursively list all sub directoriesRecursively list all sub directories Ref. Pge. 178
  • 11. File CreationFile Creation ● mkdir <sub_dir>mkdir <sub_dir> – Create a new directoryCreate a new directory ● touch <file_name>touch <file_name> – Create a new empty fileCreate a new empty file – Change time stamps of an existing fileChange time stamps of an existing file
  • 12. File DeletionFile Deletion ● rmdir <empty_dir>rmdir <empty_dir> – Remove a directoryRemove a directory – Directory must be emptyDirectory must be empty ● rm <file_name>rm <file_name> – Remove a fileRemove a file – Common options:Common options: ● -r : remove directory recursively-r : remove directory recursively ● -i : confirm before deletion-i : confirm before deletion
  • 13. File CopyingFile Copying ● cp <origin_file> <new_file>cp <origin_file> <new_file> – Existing destination will be overwrittenExisting destination will be overwritten – Multiple files can be copied into an existingMultiple files can be copied into an existing directorydirectory – Common optionsCommon options ● -i : confirm before overwriting-i : confirm before overwriting ● -r : copying directory-r : copying directory
  • 14. File MovingFile Moving ● mv <origin_file> <new_file>mv <origin_file> <new_file> – Existing destination will be overwrittenExisting destination will be overwritten – Multiple files can be moved into an existingMultiple files can be moved into an existing directorydirectory – Rename a file within the same directoryRename a file within the same directory – Common optionsCommon options ● -i : confirm before overwriting-i : confirm before overwriting
  • 15. File LinkingFile Linking ● ln <origin_file> <new_name>ln <origin_file> <new_name> – Hard link, referring a file by multiple namesHard link, referring a file by multiple names – Increase 1 in link counterIncrease 1 in link counter ● ln ­s <origin_file> <new_name>ln ­s <origin_file> <new_name> – Symbolic(Soft) link, referring a file by pathSymbolic(Soft) link, referring a file by path – No increase in link counterNo increase in link counter Ref. Pge. 190
  • 16. UsingUsing findfind ● find [dir] [option] [action]find [dir] [option] [action] – Locate files in the file systemLocate files in the file system – Starting from working directory if noStarting from working directory if no directory specifieddirectory specified Ref. Pge. 212
  • 17. Common Options ofCommon Options of findfind ● ­name 'file_name' ­name 'file_name' : file name: file name ● ­size <n>[­size <n>[bbckw] ckw]  : file size: file size ­n ­n  : less then n: less then n +n +n  : greater then n: greater then n n  n   : equal to n: equal to n ● ­mtime <n>­mtime <n> : modification time (n=24hr): modification time (n=24hr) ● ­perm <perm>­perm <perm> : permission: permission ● ­user <user>­user <user> : user name: user name ● ­group <gropu>­group <gropu> : group name: group name
  • 18. Common Actions ofCommon Actions of findfind ● ­print­print : print to STDOUT (default): print to STDOUT (default) ● ­exec cmd {} ; ­exec cmd {} ; : use results as: use results as arguments of commandarguments of command ● ­ok cmd {} ; ­ok cmd {} ; : same as -exec, with: same as -exec, with confirmationconfirmation
  • 19. UsingUsing locatelocate ● locate <path_name>locate <path_name> – List file location information extracted fromList file location information extracted from the locatedb which contains all file paths inthe locatedb which contains all file paths in the systemthe system – The locatedb is updated by the updatedb command Ref. Pge. 213
  • 20. File Type DeterminationFile Type Determination ● file <path_name>file <path_name> – Show the file type.Show the file type.
  • 21. Command LocationCommand Location ● whereis <command_name>whereis <command_name> – Show all available location of a commandShow all available location of a command Ref. Pge. 214
  • 22. Command SourceCommand Source ● which <command_name>which <command_name> – Show the exact command to run if no specificShow the exact command to run if no specific path givenpath given
  • 23. Command Type DeterminationCommand Type Determination ● type <command_name>type <command_name> – Show the actual type of a commandShow the actual type of a command – Common command types:Common command types: ● InternalInternal ● ExternalExternal ● AliasAlias ● FunctionFunction