Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Lesson 5: Managing Files

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 1


Objectives covered

o 103.3 Performing basic file management (weight: 4)


o 104.6 Create and change hard and symbolic links (weight: 2)
o 104.5 Manage file permissions and ownership (weight: 3)
o 104.7 Find system files and place files in correct location (w:2)

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 2


Create and change
hard and symbolic links

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 3


Hardlink vs Softlink

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 4


Creating Hardlink

ln file link

Notes:

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 5


Creating Softlink

ln –s file link

Notes:

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 6


Link usages

Version links

Backup

Command substitutions

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 7


Manage file permissions
and ownership

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 8


Basic file permissions

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 9


Change owner and group

chown [option] new_owner file


chgrp [option] new_group file

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 10


Change owner and group – Symbolic mode

chown mode file

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 11


Change owner and group – Octal mode

chown mode file

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 12


Default permission

umask

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 13


Special access mode

SUID (Set user id), SGID (set group id), Sticky bit

Permission Changing in Symbolic mode Changing in Octal mode


SUID chmod u+s file_name chmod 4750 file_name
SGID chmod g+s file_name chmod 2750 file_name
Sticky bit chmod o+t file_name chmod 1750 file_name
This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 14
Find system files and place
files in correct location

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 15


Locating files

which vs whereis
which whereis
Search path $PATH Linux standard paths; $PATH;
$MANPATH
File type Executable files Executable files
Source files
Manual files

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 16


Locating files

locate [option] pattern

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 17


Locating files

find [path] [option] pattern

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 18


Question...!

This document is created by Nguyen Hoang Chi Chi.Nguyen.e4w@gmail.com Page 19

You might also like