SlideShare a Scribd company logo
1 of 22
Browsing the file-system
The Linux / UNIX file-system
• The Linux file-system is hierarchical and is made of
directories, sub-directories and files.
• Directories can contain sub-directories and/or files; this is a
structure used by other file-systems, such as Microsoft-based
ones however the concept originated in UNIX.
• In Linux/Unix, everything is represented as a file; this includes
processes, devices, applications, I/O sockets, etc.
• Directories are a file as well, they contain the information of
any files directly under them, hierarchically.
Linux file-system Structure
• The Linux file-system structure is “tree” like.
• The file-system begins at a directory named “/”, which is also
referred to as the “root” directory.
• The “drives” representation is different than in Windows.
There are no C: or D: drives; each drive has a Mount Point,
which is a location under the root (/) directory in which it is
represented.
• Mount points can be created by the sys-admin that serve as
“connection” points of sort to physical devices and/or other
file-systems
Most Unix systems has the default /mnt directory for
arbitrary mounts. Linux systems, has the /media as an
additional default directory for removable storage devices
Linux file-system Structure
• Below is a visual representation of the basic Linux file-system
structure:
Absolute Directory Paths
• Absolute: the root of Linux’s file-system is represented as “/”;
this slash mark will always be present when we use absolute
pathnames to navigate the file-system, for example:
/var/log/messages.log
• The first / in the example above represents the root dir, “var”
is a directory sitting directly under the root dir and “log” is a
directory under “var”. Finally, “messages.log” is the name of a
file which resides in /var/log/.
Relative Directory Paths
• Relative: relative pathnames refers to the current location in
the file-system as the point of origin and not the root
directory. Let’s assume we are in the /var/ directory right
now, in order to reach messages.log file we will use the
following path: log/messages.log
• Note that there is no / at the beginning of the pathname and
that it begins with the “log” directory, since we are already
inside /var/
Home Directories
• Every Linux user has a “home” directory; the home dirs reside
in /home/<username>
• The home dir has a few uses and advantages to its owner:
 It is the directory a user goes to after logging into the system.
 It becomes the current working directory after login.
 The owning user can freely create files and/or directories in it.
 Other users do not have permissions to access a home directory not
owned by themselves, with the exclusion of the user “root” which is
the administrative user of the system or other users that have been
granted special permissions by the admin.
 The home dir contains customization files which are loaded upon
login. (.bash_profile / .bashrc and others)
 Contains the history of the shell commands executed by the specific
user (.bash_history)
Navigating through directories
• There are two commands that aid us with navigating through
the file-system:
 PWD – Print Working Directory; displays the absolute pathname of
the current working directory:
# pwd
/home/nir
 CD – change directory; make the specified pathname our current
working directory. can be used with either absolute or relative
pathnames:
# cd /var/log
# pwd
/var/log
Navigating through directories
 CD with a relative pathname:
 # pwd
/var
# cd log
# pwd
/var/log
 CD without any pathname will make the user’s home dir the
current working directory:
 # pwd
/var/log
# cd
# pwd
/home/nir
Navigating through directories
• Pathname navigations has a few shortcuts to make things
simpler:
 . : represents the current working directory, for example: if the
current working dir is /var/log/ “ls .” will display the log files in this dir.
 .. : represents the parent directory, one level above the current
working directory; following the above example, “ls ..” will display the
contents of /var/
 ~ : represents the home directory, each user and their own home.
example: “cd ~” will take the user “nir” into /home/nir/
 - : return to the previous working directory; “cd –” will return to the
working directory we were in before the last “cd” command we’ve
performed.
Listing directory contents
• The “ls” command is used to list the contents of directories. It
has numerous options that allow the displaying and sorting of
information in a few different ways.
• “ls” command syntax is as follows:
 ls [-option] [pathname[s]]
• If no options or arguments are given, “ls” by itself will list the
current working directory’s contents, for example:
 # ls
file1 file2 file3
Listing directory contents
• “ls” has a few additional options to control the listing results
and sorting:
 -a : display hidden files
 -i : display inode numbers
 -R : list sub-directories’ contents recursively
 -d : list the directory details, not the files inside of it
 -l : display long list
 -t : sort by modification time
 -r : sort in reverse order
There are numerous additional options, run: ls --help to view them.
Displaying long listing
• To see detailed information about the contents of a directory
use the “ls -l” command.
• The various fields of this table contains most of the
information about a file, its permissions and times:
 # ls -l
drwxrwxr-x 2 nir nir 4096 Jul 19 13:58 directory
-rw-rw-r-- 1 nir nir 135 Jul 19 13:42 file1
-rwxrwxr-- 1 nir nir 35 Jul 19 13:42 file2
-rw-rw-r-- 1 nir nir 200 Jul 19 13:42 file3
Metacharacters
• Metacharacters are characters which are interpreted by the
shell as more than just any regular character.
• These characters include: ! ; * | % $ ? <> []
• It is highly recommended to Avoid using metacharacters
when naming files and/or directories; it will work but is also
likely to cause trouble.
• When executing a command in the shell, the shell scans the
whole command for metacharacters; if any are found, the
shell “expands” these characters to their actual meaning
before the execution of the command, for example, when
running the command: “ls –la ~” the shell will first interpret
the ~ mark into its actual meaning, which is the current user’s
home dir and then execute: “ls –la /home/<username>”.
Metacharacters
• The Asterisk “*” character’s special meaning is: zero or more
characters; this character is also known as the “Wildcard”
character, example:
 # ls
dfile1 dfile2 directory file1 file2 file3 kfile9 mfile1
# ls k*
kfile9
• Filenames with a leading dot ( . ), such as “.bash_profile” are
categorized as “hidden” by the file-system
Metacharacters
• The question mark’s “?” special meaning is: match any single
character (except a leading dot in hidden files). example:
 # ls
afile1 afile2 afile123 afile directory file1 file2 file3 kfile9 mfile1
# ls afile?
afile1 afile2
Metacharacters
• The square brackets “[]” special meaning is: match a set or a
range of characters in a single position.
example:
 # ls
dfile1 dfile2 directory file1 file2 file3 kfile9 mfile1
# ls [mk]*
kfile9 mfile1
Basic file management
• ‘cp’ copy a file to a new file or a list of files to a directory
• Syntax:
 cp [options] file(s) file|directory
• Options:
 -i run interactively, ask before overwriting files
 -f force copy, overwrite automatically
 -r recursively copy files and sub-directories
$ cp file file_new
$ ls -l file file_new
-rw-r--r-- 1 root root 4 Jul 23 21:02 file
-rw-r--r-- 1 root root 4 Jul 23 22:11 file_new
Basic file management
• ‘mv’ move or rename a file or move a list of files to a
directory
• Syntax:
 mv [options] file(s) file|directory
• Options:
 -i run interactively, ask before overwriting files
 -f force copy, overwrite automatically
$ mv file file_new
$ ls -l file file_new
ls: file: No such file or directory
-rw-r--r-- 1 root root 4 Jul 23 22:11 file_new
Basic file management
• ‘ln’ creates a new link for a file
• Syntax:
 ln [options] file link
• Options:
 -s create a symbolic link
 -f force linking, overwrite automatically
$ ln -s file file_new
$ ls -l file file_new
-rw-r--r-- 1 root root 5 Jul 23 22:25 file
lrwxrwxrwx 1 root root 4 Jul 23 22:26 file_new -> file
Basic file management
• ‘rm’ removes a file or files list
• Syntax:
 rm [options] file(s)
• Options:
 -r recursively remove files and sub-directories
 -f force copy, overwrite automatically
$ rm file_new
$ ls -l file file_new
ls: file: No such file or directory
ls: file_new: No such file or directory
Basic file management
• ‘mkdir’ create a new directory
• Syntax:
 mkdir [options] directory
• Options:
 -p create parent directories, if needed
$ mkdir dir1
$ ls -l
drwxr-xr-x 2 root root 4096 Jul 23 22:20 dir1
Note: ‘mkdir’ is the only command from the above that can create a new
directory. ‘cp’ and ‘mv’ will only copy existing directories with given ‘-r’

More Related Content

What's hot

1 basic computer operations
1   basic computer operations1   basic computer operations
1 basic computer operationsmissCS
 
Directory Commands - R.D.Sivakumar
Directory Commands - R.D.SivakumarDirectory Commands - R.D.Sivakumar
Directory Commands - R.D.SivakumarSivakumar R D .
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testingGaruda Trainings
 
BITS: Introduction to Linux - Software installation the graphical and the co...
BITS: Introduction to Linux -  Software installation the graphical and the co...BITS: Introduction to Linux -  Software installation the graphical and the co...
BITS: Introduction to Linux - Software installation the graphical and the co...BITS
 
Managing files chapter 7
Managing files chapter 7 Managing files chapter 7
Managing files chapter 7 shinigami-99
 
Linux - Directory commands
Linux - Directory commandsLinux - Directory commands
Linux - Directory commandsjoesofi
 
File types atul namdeo
File types  atul namdeoFile types  atul namdeo
File types atul namdeoAtul Namdeo
 
Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Ahmed El-Arabawy
 
Learning Bash For linux Command Line
Learning Bash For linux Command LineLearning Bash For linux Command Line
Learning Bash For linux Command LineMohamed Alaa El-Din
 
Perintah dasar terminal kali linux
Perintah dasar terminal kali linuxPerintah dasar terminal kali linux
Perintah dasar terminal kali linuxFaizalguswanda
 
OpenGurukul : Operating System : Linux
OpenGurukul : Operating System : LinuxOpenGurukul : Operating System : Linux
OpenGurukul : Operating System : LinuxOpen Gurukul
 

What's hot (18)

1 basic computer operations
1   basic computer operations1   basic computer operations
1 basic computer operations
 
Basic Linux day 2
Basic Linux day 2Basic Linux day 2
Basic Linux day 2
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Directory Commands - R.D.Sivakumar
Directory Commands - R.D.SivakumarDirectory Commands - R.D.Sivakumar
Directory Commands - R.D.Sivakumar
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testing
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
BITS: Introduction to Linux - Software installation the graphical and the co...
BITS: Introduction to Linux -  Software installation the graphical and the co...BITS: Introduction to Linux -  Software installation the graphical and the co...
BITS: Introduction to Linux - Software installation the graphical and the co...
 
Comp practical
Comp practicalComp practical
Comp practical
 
File management
File managementFile management
File management
 
Managing files chapter 7
Managing files chapter 7 Managing files chapter 7
Managing files chapter 7
 
Os lab manual
Os lab manualOs lab manual
Os lab manual
 
Linux - Directory commands
Linux - Directory commandsLinux - Directory commands
Linux - Directory commands
 
File types atul namdeo
File types  atul namdeoFile types  atul namdeo
File types atul namdeo
 
Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling
 
Learning Bash For linux Command Line
Learning Bash For linux Command LineLearning Bash For linux Command Line
Learning Bash For linux Command Line
 
Hos
HosHos
Hos
 
Perintah dasar terminal kali linux
Perintah dasar terminal kali linuxPerintah dasar terminal kali linux
Perintah dasar terminal kali linux
 
OpenGurukul : Operating System : Linux
OpenGurukul : Operating System : LinuxOpenGurukul : Operating System : Linux
OpenGurukul : Operating System : Linux
 

Viewers also liked

CyberScope - 2015 Market Review
CyberScope - 2015 Market ReviewCyberScope - 2015 Market Review
CyberScope - 2015 Market Reviewresultsig
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usageShay Cohen
 
Hoopsfix All Star Classic 2014 Programme
Hoopsfix All Star Classic 2014 ProgrammeHoopsfix All Star Classic 2014 Programme
Hoopsfix All Star Classic 2014 ProgrammeHoopsfix
 
Niche Credentials Dec 2015
Niche Credentials Dec 2015Niche Credentials Dec 2015
Niche Credentials Dec 2015Zoheb Deshmukh
 
5 Winning Strategies - Social Ecommerce Ebook
5 Winning Strategies - Social Ecommerce Ebook5 Winning Strategies - Social Ecommerce Ebook
5 Winning Strategies - Social Ecommerce EbookMelih ÖZCANLI
 
Employee Engagement: Fluffy Nonsense or Mission Critical?
Employee Engagement: Fluffy Nonsense or Mission Critical? Employee Engagement: Fluffy Nonsense or Mission Critical?
Employee Engagement: Fluffy Nonsense or Mission Critical? Bloomfire
 
Hoe belangrijk zijn ondernemers voor Vlaanderen
Hoe belangrijk zijn ondernemers voor VlaanderenHoe belangrijk zijn ondernemers voor Vlaanderen
Hoe belangrijk zijn ondernemers voor VlaanderenUNIZO
 
Geek Sync I Dealing with Bad Roommates - SQL Server Resource Governor
Geek Sync I Dealing with Bad Roommates - SQL Server Resource GovernorGeek Sync I Dealing with Bad Roommates - SQL Server Resource Governor
Geek Sync I Dealing with Bad Roommates - SQL Server Resource GovernorIDERA Software
 
Searching for Users: SEO as an Engine for Customer Acquisition (Stephan Spenc...
Searching for Users: SEO as an Engine for Customer Acquisition (Stephan Spenc...Searching for Users: SEO as an Engine for Customer Acquisition (Stephan Spenc...
Searching for Users: SEO as an Engine for Customer Acquisition (Stephan Spenc...Dealmaker Media
 
Geek Sync | Avoid Corruption Nightmares within your Virtual Database
Geek Sync | Avoid Corruption Nightmares within your Virtual DatabaseGeek Sync | Avoid Corruption Nightmares within your Virtual Database
Geek Sync | Avoid Corruption Nightmares within your Virtual DatabaseIDERA Software
 
Application Acceleration: Faster Performance for End Users
Application Acceleration: Faster Performance for End Users	Application Acceleration: Faster Performance for End Users
Application Acceleration: Faster Performance for End Users Eric Kavanagh
 
Infographic: The Accidental DBA
Infographic: The Accidental DBAInfographic: The Accidental DBA
Infographic: The Accidental DBAIDERA Software
 
Who, What, Where and How: Why You Want to Know
 Who, What, Where and How: Why You Want to Know Who, What, Where and How: Why You Want to Know
Who, What, Where and How: Why You Want to KnowEric Kavanagh
 
Geek Sync I CSI for SQL: Learn to be a SQL Sleuth
Geek Sync I CSI for SQL: Learn to be a SQL SleuthGeek Sync I CSI for SQL: Learn to be a SQL Sleuth
Geek Sync I CSI for SQL: Learn to be a SQL SleuthIDERA Software
 
Hcad competencies booklet (2) (1)
Hcad competencies booklet (2) (1)Hcad competencies booklet (2) (1)
Hcad competencies booklet (2) (1)Ngonde
 
The Art of Visibility: Enabling Multi-Platform Management
The Art of Visibility: Enabling Multi-Platform ManagementThe Art of Visibility: Enabling Multi-Platform Management
The Art of Visibility: Enabling Multi-Platform ManagementEric Kavanagh
 

Viewers also liked (18)

CyberScope - 2015 Market Review
CyberScope - 2015 Market ReviewCyberScope - 2015 Market Review
CyberScope - 2015 Market Review
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usage
 
Hoopsfix All Star Classic 2014 Programme
Hoopsfix All Star Classic 2014 ProgrammeHoopsfix All Star Classic 2014 Programme
Hoopsfix All Star Classic 2014 Programme
 
Niche Credentials Dec 2015
Niche Credentials Dec 2015Niche Credentials Dec 2015
Niche Credentials Dec 2015
 
5 Winning Strategies - Social Ecommerce Ebook
5 Winning Strategies - Social Ecommerce Ebook5 Winning Strategies - Social Ecommerce Ebook
5 Winning Strategies - Social Ecommerce Ebook
 
Employee Engagement: Fluffy Nonsense or Mission Critical?
Employee Engagement: Fluffy Nonsense or Mission Critical? Employee Engagement: Fluffy Nonsense or Mission Critical?
Employee Engagement: Fluffy Nonsense or Mission Critical?
 
Hoe belangrijk zijn ondernemers voor Vlaanderen
Hoe belangrijk zijn ondernemers voor VlaanderenHoe belangrijk zijn ondernemers voor Vlaanderen
Hoe belangrijk zijn ondernemers voor Vlaanderen
 
Geek Sync I Dealing with Bad Roommates - SQL Server Resource Governor
Geek Sync I Dealing with Bad Roommates - SQL Server Resource GovernorGeek Sync I Dealing with Bad Roommates - SQL Server Resource Governor
Geek Sync I Dealing with Bad Roommates - SQL Server Resource Governor
 
Searching for Users: SEO as an Engine for Customer Acquisition (Stephan Spenc...
Searching for Users: SEO as an Engine for Customer Acquisition (Stephan Spenc...Searching for Users: SEO as an Engine for Customer Acquisition (Stephan Spenc...
Searching for Users: SEO as an Engine for Customer Acquisition (Stephan Spenc...
 
Geek Sync | Avoid Corruption Nightmares within your Virtual Database
Geek Sync | Avoid Corruption Nightmares within your Virtual DatabaseGeek Sync | Avoid Corruption Nightmares within your Virtual Database
Geek Sync | Avoid Corruption Nightmares within your Virtual Database
 
Application Acceleration: Faster Performance for End Users
Application Acceleration: Faster Performance for End Users	Application Acceleration: Faster Performance for End Users
Application Acceleration: Faster Performance for End Users
 
Infographic: The Accidental DBA
Infographic: The Accidental DBAInfographic: The Accidental DBA
Infographic: The Accidental DBA
 
Who, What, Where and How: Why You Want to Know
 Who, What, Where and How: Why You Want to Know Who, What, Where and How: Why You Want to Know
Who, What, Where and How: Why You Want to Know
 
Geek Sync I CSI for SQL: Learn to be a SQL Sleuth
Geek Sync I CSI for SQL: Learn to be a SQL SleuthGeek Sync I CSI for SQL: Learn to be a SQL Sleuth
Geek Sync I CSI for SQL: Learn to be a SQL Sleuth
 
The Tux 3 Linux Filesystem
The Tux 3 Linux FilesystemThe Tux 3 Linux Filesystem
The Tux 3 Linux Filesystem
 
Hcad competencies booklet (2) (1)
Hcad competencies booklet (2) (1)Hcad competencies booklet (2) (1)
Hcad competencies booklet (2) (1)
 
AlpineII
AlpineIIAlpineII
AlpineII
 
The Art of Visibility: Enabling Multi-Platform Management
The Art of Visibility: Enabling Multi-Platform ManagementThe Art of Visibility: Enabling Multi-Platform Management
The Art of Visibility: Enabling Multi-Platform Management
 

Similar to 03 browsing the filesystem

linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.pptMeesanRaza
 
Chapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptxChapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptxalehegn9
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystemroot_fibo
 
Linux file system nevigation
Linux file system nevigationLinux file system nevigation
Linux file system nevigationhetaldobariya
 
2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptx2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptxPriyadarshini648418
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2Gourav Varma
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdfamitkamble79
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentalsRaghu nath
 
Command Line Tools
Command Line ToolsCommand Line Tools
Command Line ToolsDavid Harris
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS
 

Similar to 03 browsing the filesystem (20)

linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
 
Chapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptxChapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptx
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystem
 
Linux file system nevigation
Linux file system nevigationLinux file system nevigation
Linux file system nevigation
 
Linuxnishustud
LinuxnishustudLinuxnishustud
Linuxnishustud
 
2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptx2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptx
 
Linux Fundamentals
Linux FundamentalsLinux Fundamentals
Linux Fundamentals
 
Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Basics of Linux
Basics of LinuxBasics of Linux
Basics of Linux
 
Directories description
Directories descriptionDirectories description
Directories description
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentals
 
Command Line Tools
Command Line ToolsCommand Line Tools
Command Line Tools
 
Linux[122-150].pdf
Linux[122-150].pdfLinux[122-150].pdf
Linux[122-150].pdf
 
Unix training session 1
Unix training   session 1Unix training   session 1
Unix training session 1
 
Linux: Basics OF Linux
Linux: Basics OF LinuxLinux: Basics OF Linux
Linux: Basics OF Linux
 
Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
 

More from Shay Cohen

Linux Performance Tunning Memory
Linux Performance Tunning MemoryLinux Performance Tunning Memory
Linux Performance Tunning MemoryShay Cohen
 
Linux Performance Tunning Kernel
Linux Performance Tunning KernelLinux Performance Tunning Kernel
Linux Performance Tunning KernelShay Cohen
 
Linux Performance Tunning introduction
Linux Performance Tunning introductionLinux Performance Tunning introduction
Linux Performance Tunning introductionShay Cohen
 
chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinuxShay Cohen
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/CoreShay Cohen
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationShay Cohen
 
14 network tools
14 network tools14 network tools
14 network toolsShay Cohen
 
13 process management
13 process management13 process management
13 process managementShay Cohen
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving toolsShay Cohen
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copyShay Cohen
 
10 finding files
10 finding files10 finding files
10 finding filesShay Cohen
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_toolsShay Cohen
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editorShay Cohen
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissionsShay Cohen
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipesShay Cohen
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bashShay Cohen
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copyShay Cohen
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overviewShay Cohen
 

More from Shay Cohen (18)

Linux Performance Tunning Memory
Linux Performance Tunning MemoryLinux Performance Tunning Memory
Linux Performance Tunning Memory
 
Linux Performance Tunning Kernel
Linux Performance Tunning KernelLinux Performance Tunning Kernel
Linux Performance Tunning Kernel
 
Linux Performance Tunning introduction
Linux Performance Tunning introductionLinux Performance Tunning introduction
Linux Performance Tunning introduction
 
chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinux
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automation
 
14 network tools
14 network tools14 network tools
14 network tools
 
13 process management
13 process management13 process management
13 process management
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
 
10 finding files
10 finding files10 finding files
10 finding files
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_tools
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editor
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissions
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipes
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bash
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copy
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overview
 

Recently uploaded

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

03 browsing the filesystem

  • 2. The Linux / UNIX file-system • The Linux file-system is hierarchical and is made of directories, sub-directories and files. • Directories can contain sub-directories and/or files; this is a structure used by other file-systems, such as Microsoft-based ones however the concept originated in UNIX. • In Linux/Unix, everything is represented as a file; this includes processes, devices, applications, I/O sockets, etc. • Directories are a file as well, they contain the information of any files directly under them, hierarchically.
  • 3. Linux file-system Structure • The Linux file-system structure is “tree” like. • The file-system begins at a directory named “/”, which is also referred to as the “root” directory. • The “drives” representation is different than in Windows. There are no C: or D: drives; each drive has a Mount Point, which is a location under the root (/) directory in which it is represented. • Mount points can be created by the sys-admin that serve as “connection” points of sort to physical devices and/or other file-systems Most Unix systems has the default /mnt directory for arbitrary mounts. Linux systems, has the /media as an additional default directory for removable storage devices
  • 4. Linux file-system Structure • Below is a visual representation of the basic Linux file-system structure:
  • 5. Absolute Directory Paths • Absolute: the root of Linux’s file-system is represented as “/”; this slash mark will always be present when we use absolute pathnames to navigate the file-system, for example: /var/log/messages.log • The first / in the example above represents the root dir, “var” is a directory sitting directly under the root dir and “log” is a directory under “var”. Finally, “messages.log” is the name of a file which resides in /var/log/.
  • 6. Relative Directory Paths • Relative: relative pathnames refers to the current location in the file-system as the point of origin and not the root directory. Let’s assume we are in the /var/ directory right now, in order to reach messages.log file we will use the following path: log/messages.log • Note that there is no / at the beginning of the pathname and that it begins with the “log” directory, since we are already inside /var/
  • 7. Home Directories • Every Linux user has a “home” directory; the home dirs reside in /home/<username> • The home dir has a few uses and advantages to its owner:  It is the directory a user goes to after logging into the system.  It becomes the current working directory after login.  The owning user can freely create files and/or directories in it.  Other users do not have permissions to access a home directory not owned by themselves, with the exclusion of the user “root” which is the administrative user of the system or other users that have been granted special permissions by the admin.  The home dir contains customization files which are loaded upon login. (.bash_profile / .bashrc and others)  Contains the history of the shell commands executed by the specific user (.bash_history)
  • 8. Navigating through directories • There are two commands that aid us with navigating through the file-system:  PWD – Print Working Directory; displays the absolute pathname of the current working directory: # pwd /home/nir  CD – change directory; make the specified pathname our current working directory. can be used with either absolute or relative pathnames: # cd /var/log # pwd /var/log
  • 9. Navigating through directories  CD with a relative pathname:  # pwd /var # cd log # pwd /var/log  CD without any pathname will make the user’s home dir the current working directory:  # pwd /var/log # cd # pwd /home/nir
  • 10. Navigating through directories • Pathname navigations has a few shortcuts to make things simpler:  . : represents the current working directory, for example: if the current working dir is /var/log/ “ls .” will display the log files in this dir.  .. : represents the parent directory, one level above the current working directory; following the above example, “ls ..” will display the contents of /var/  ~ : represents the home directory, each user and their own home. example: “cd ~” will take the user “nir” into /home/nir/  - : return to the previous working directory; “cd –” will return to the working directory we were in before the last “cd” command we’ve performed.
  • 11. Listing directory contents • The “ls” command is used to list the contents of directories. It has numerous options that allow the displaying and sorting of information in a few different ways. • “ls” command syntax is as follows:  ls [-option] [pathname[s]] • If no options or arguments are given, “ls” by itself will list the current working directory’s contents, for example:  # ls file1 file2 file3
  • 12. Listing directory contents • “ls” has a few additional options to control the listing results and sorting:  -a : display hidden files  -i : display inode numbers  -R : list sub-directories’ contents recursively  -d : list the directory details, not the files inside of it  -l : display long list  -t : sort by modification time  -r : sort in reverse order There are numerous additional options, run: ls --help to view them.
  • 13. Displaying long listing • To see detailed information about the contents of a directory use the “ls -l” command. • The various fields of this table contains most of the information about a file, its permissions and times:  # ls -l drwxrwxr-x 2 nir nir 4096 Jul 19 13:58 directory -rw-rw-r-- 1 nir nir 135 Jul 19 13:42 file1 -rwxrwxr-- 1 nir nir 35 Jul 19 13:42 file2 -rw-rw-r-- 1 nir nir 200 Jul 19 13:42 file3
  • 14. Metacharacters • Metacharacters are characters which are interpreted by the shell as more than just any regular character. • These characters include: ! ; * | % $ ? <> [] • It is highly recommended to Avoid using metacharacters when naming files and/or directories; it will work but is also likely to cause trouble. • When executing a command in the shell, the shell scans the whole command for metacharacters; if any are found, the shell “expands” these characters to their actual meaning before the execution of the command, for example, when running the command: “ls –la ~” the shell will first interpret the ~ mark into its actual meaning, which is the current user’s home dir and then execute: “ls –la /home/<username>”.
  • 15. Metacharacters • The Asterisk “*” character’s special meaning is: zero or more characters; this character is also known as the “Wildcard” character, example:  # ls dfile1 dfile2 directory file1 file2 file3 kfile9 mfile1 # ls k* kfile9 • Filenames with a leading dot ( . ), such as “.bash_profile” are categorized as “hidden” by the file-system
  • 16. Metacharacters • The question mark’s “?” special meaning is: match any single character (except a leading dot in hidden files). example:  # ls afile1 afile2 afile123 afile directory file1 file2 file3 kfile9 mfile1 # ls afile? afile1 afile2
  • 17. Metacharacters • The square brackets “[]” special meaning is: match a set or a range of characters in a single position. example:  # ls dfile1 dfile2 directory file1 file2 file3 kfile9 mfile1 # ls [mk]* kfile9 mfile1
  • 18. Basic file management • ‘cp’ copy a file to a new file or a list of files to a directory • Syntax:  cp [options] file(s) file|directory • Options:  -i run interactively, ask before overwriting files  -f force copy, overwrite automatically  -r recursively copy files and sub-directories $ cp file file_new $ ls -l file file_new -rw-r--r-- 1 root root 4 Jul 23 21:02 file -rw-r--r-- 1 root root 4 Jul 23 22:11 file_new
  • 19. Basic file management • ‘mv’ move or rename a file or move a list of files to a directory • Syntax:  mv [options] file(s) file|directory • Options:  -i run interactively, ask before overwriting files  -f force copy, overwrite automatically $ mv file file_new $ ls -l file file_new ls: file: No such file or directory -rw-r--r-- 1 root root 4 Jul 23 22:11 file_new
  • 20. Basic file management • ‘ln’ creates a new link for a file • Syntax:  ln [options] file link • Options:  -s create a symbolic link  -f force linking, overwrite automatically $ ln -s file file_new $ ls -l file file_new -rw-r--r-- 1 root root 5 Jul 23 22:25 file lrwxrwxrwx 1 root root 4 Jul 23 22:26 file_new -> file
  • 21. Basic file management • ‘rm’ removes a file or files list • Syntax:  rm [options] file(s) • Options:  -r recursively remove files and sub-directories  -f force copy, overwrite automatically $ rm file_new $ ls -l file file_new ls: file: No such file or directory ls: file_new: No such file or directory
  • 22. Basic file management • ‘mkdir’ create a new directory • Syntax:  mkdir [options] directory • Options:  -p create parent directories, if needed $ mkdir dir1 $ ls -l drwxr-xr-x 2 root root 4096 Jul 23 22:20 dir1 Note: ‘mkdir’ is the only command from the above that can create a new directory. ‘cp’ and ‘mv’ will only copy existing directories with given ‘-r’

Editor's Notes

  1. Make sure everyone take notes (!)
  2. Explain about each one - (!)
  3. Discussion: Explain about hidden files
  4. Explain about MV and why it has no ‘-r’
  5. Explain briefly about non-symbolic links
  6. Explain about ‘ rm -rf ‘ ls: file: No such file or directory
  7. try running ‘ mkdir new_dir/new_subdir ’