(Go: >> BACK << -|- >> HOME <<)

SlideShare a Scribd company logo
Lesson 7-Creating and Changing Directories
Overview  Using directories to create order. Managing files in directories. Using pathnames to manage files in directories. Accessing files in remote directories. Managing files from more than one directory. Moving and removing directories and their contents.
Using Directories to Create Order  A file is a collection of information stored electronically on the hard drive of a system. An inode contains all the information about each file, including the location of the actual file on the disk.
Using Directories to Create Order  The home directory. Listing files in a directory. Working with directories. Distinguishing between files and directories. Obtaining information about a directory or its contents.
The Home Directory The “pwd” command displays the path from root to the user’s home directory. The /etc/passwd file holds the user’s home directory path. A file is created and listed in the current home directory by default.
Listing Files in a Directory  The “ls” command reads the names of the files listed in the current directory, and then outputs those names. Each file in the directory contains only the name of that file and a number that leads to the inode for that file. The “–i” option instructs ls to include the inodes in its output. Inodes are small pieces of memory created on the hard disk when it is formatted.
Listing Files in a Directory  The inode has a list of addresses of the block on the disk where the data that comprise the file is actually located. It addresses up to 13 data blocks on the hard drive. The first ten blocks addressed from the inode contains the actual file data. If a file is too large, additional blocks are allocated to fit the data.
Working with Directories  The “mkdir” command is used for creating a new directory. Directories created in uppercase are listed first by the ls command. Each new directory created is called a subdirectory. The “cd” or “change directory” command instructs the shell to locate the directory listed as an argument.
Working with Directories  The “pwd” command outputs the absolute path from the top of the file system (root or /) to the current directory.  A path is a list of directory names separated by the / (slash) character. The topmost directory is called the root and is symbolized by the first forward slash (/) in the pathname.
Working with Directories  The vi editor can be used for creating a file within a directory or subdirectory. The cd command, without any directory name as an argument, returns to the home directory. The “–R” (recursive) option used with ls descends through each subdirectory in the directory tree.
Distinguishing between Files and Directories The “ls –F” command displays directory names with a slash appended at the end. Filenames displayed with an asterisk (*) at the end are executable files. The “–C” option to ls instructs ls to make several columns in the output instead of one.
Obtaining Information About a Directory or its Contents The “ls –l” command displays the permissions and owners of files listed in a directory. The “–d” option with ls command returns a listing of information about the contents of the target directory. The “ls –ld” displays the permissions of the directory, and not the information about the files.
Managing Files in Directories Moving or copying files into a subdirectory. Accessing a file in a subdirectory. Avoiding mistakes when moving files into directories. Renaming files. Removing files from subdirectories.
Moving or Copying Files into a Subdirectory  Moving a file or directory does not move the file electronically. The name and the inode number are erased from the current directory and are written in the subdirectory.
Moving or Copying Files into a Subdirectory  When a file is copied, a second electronic version is created. The copied file does not have the same inode number as the original. The copied file has its own inode, permission, and data blocks containing the new files actual contents.
Accessing a File in a Subdirectory To access a file in a subdirectory: Locate the inode number of the file. Check the permissions on the directory. Get the directory’s address from the inode. Identify the inode associated with the file. Read the files from the data blocks.
Avoiding Mistakes When Moving Files into Directories The mv utility takes two arguments. The first argument is the name of an existing file. The second argument is a new name assigned to existing file, unless the second argument is a directory. A slash at the end of the second argument interprets the argument as a directory name.
Renaming Files The command to move a file listing from the current directory to a new directory and also to change its filename is mv filename subdirectory/newfilename. Moving a file just moves its listing from one directory to another.
Removing Files from Subdirectories  The “rm” command can be used for removing files form a directory or subdirectory. After the rm command, the entry of the file is removed, and the data blocks listed in the inode for that file are released.
Using Pathnames to Manage Files in Directories  Accessing or creating a subdirectory. Using pathnames with utilities. Copying files into other directories using paths. Using parent directory names. Copying and moving multiple files to subdirectories. Examining the full path from root to directories and files.
Using Pathnames to Manage Files in Directories  Explicitly accessing a user’s home directory. Including other users’ logins in directory paths. Returning to the previous directory.
Accessing or Creating a Subdirectory  Providing a full path to the cd command without any spaces can access a subdirectory. Pathnames are the mechanism used to tell the shell what path to follow to access a file or directory not listed in the current directory. Remote directories can also be created by specifying the relative or absolute pathname.
Using Pathnames with Utilities  Pathnames can also be used as arguments to utilities. A relative path can be specified for accessing a file without changing the current directory.
Copying Files into Other Directories Using Paths  Pathnames are particularly useful with the “cp” and “mv” commands. Any command that takes a filename or directory name as an argument can be given an explicit pathname argument.
Using Parent Directory Names A single dot is used for referring to the current directory. In a directory, the .. (dot-dot) is the listing for its parent directory.  The parent directory is the directory located one level above the current directory.
Using Parent Directory Names The parent directory lists the current directory’s name and inode. The . and .. are the two listings that get created when a new directory is created.
Copying and Moving Multiple Files to Subdirectories  The move and copy commands are usually used with only two arguments. The cp utility displays a usage error message when more than two arguments are specified and the last argument is not a directory. In the cp command, if the third argument specified is a directory, then the rest of the file arguments are copied into the destination subdirectory.
Copying and Moving Multiple Files to Subdirectories  The mv and cp commands can affect multiple files when the last argument is a directory. The .. (dot-dot) listing can be used in the mv command for moving files into the parent directory.
Examining the Full Path from Root to Directories and Files A user can specify a directory’s location with the full path from the top of the file system. The full path starting at root identifies a file explicitly. The pathname for every file describes a particular file uniquely and absolutely. The full pathname to a file is called its absolute pathname.
Explicitly Accessing a User’s Home Directory  The “ls ~” command lists all filenames listed in the home directory. The C shell and all shells define the tilde (~) as the path to the user’s home directory. The shell replaces the tilde (~) with the value of the path to the user’s home directory. The shell replaces the tilde (~) in any command line with the absolute path from root to the user’s home directory.
Including Other Users’ Logins in Directory Paths The “echo ~root” option displays the path to the home directory of the user root. The contents of the home directory of a user are displayed if the user has appropriate permissions.
Returning to the Previous Directory The bash and ksh shells maintain the previous directory path as the value of a variable. The tcsh shell maintains a list of previous directories in a list that can be accessed. The value of the variable PWD is the path to the current directory.
Returning to the Previous Directory An alternative way of specifying the previous directory on many bash and ksh shells is to do it with a dash argument. The exit command can be used for exiting from a child bash or ksh to the login shell. The “popd” command instructs the shell to move the directory currently on the top of the list of directories that are added to the list.
Accessing Files in Remote Directories A filename that includes no relative path defaults to the current directory. The ./ is the default relative path that is used. Every file on the system has a unique pathname from / (root).
Accessing Files in Remote Directories The “pwd” command displays the absolute path of the present directory. A path always starts at root (/) and includes the appropriate subdirectories.
Managing Files from More Than One Directory A listing for a file in a directory is a link to the file. The ls –l command at the start lists the number of data blocks used by files and directories in the current directory. In a long listing entry, or record, the information for each file or directory is divided into seven fields. The second field in each entry of a file indicates the number of directories where the object is listed.
Managing Files from More Than One Directory Linking files: The “ln” command can be used for linking a file to the current directory. The index card of each file keeps track of the number of directories that list it. Each instance of the file listed in a directory is one link. Removing a file removes it from the directory listing.
Managing Files from More Than One Directory Linking files (continued): The ln utility can be used to link multiple files at a time. The “ls –il” command lists the current files with link count and inodes. The “–s” option to ln creates a file in the current directory that contains information required to locate the linked file.
Managing Files from More Than One Directory Using symbolic links: A symbolic link is a small file in a directory on one file system partition that points to the correct file system and the correct inode for the linked file. In the long listing of the symbolic link, the initial character is an “l” for directories and files. An arrow and path at the end of the listing displays the actual directory where the link points.
Managing Files from More Than One Directory Using symbolic links (continued): The ln utility provides a “–d” option for the root user to create hard links to directories. Ordinary users cannot create directory hard links. Ordinary users can create symbolic links to directories.
Managing Files from More Than One Directory The administrator can divide the hard drive into partitions for installing the system.  The partition labeled / holds the core of the hierarchal directory tree. A partition is further divided into small pieces called data blocks, which hold the actual data for the file.
Managing Files from More Than One Directory Each partition holds a single file system and has a set of unique inode numbers for that partition. The inode contains the whole of a file, including its descriptive characteristics and the addresses of the blocks where the file data resides.
Moving and Removing Directories and their Contents  Renaming a directory only changes the name of the directory, the inode number and its location remains unchanged. A directory can also be moved from a different location in the hierarchal file structure without affecting the child contents of the directory.
The “rmdir” command is used for removing an empty directory. The “–r” option instructs the rm command to recursively remove file. Moving and Removing Directories and their Contents
Summary  Files reside in one or more data blocks on the hard drive. Each file in a directory is assigned a unique inode. A directory is a special kind of file with very specific contents, namely the names of files and directories, each with its associated inode number. The passwd file holds the location of a user’s home directory.
Summary  The mkdir command is used for creating remote directories. The tilde (~) is interpreted as the user’s home directory. The name .. (dot-dot) is interpreted as the parent directory. The “rm –r dirname” command recursively removes the contents of the directory specified.

More Related Content

What's hot

Unix command line concepts
Unix command line conceptsUnix command line concepts
Unix command line concepts
Artem Nagornyi
 
intro unix/linux 03
intro unix/linux 03intro unix/linux 03
intro unix/linux 03
duquoi
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
Shay Cohen
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
chockit88
 
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSVTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
vtunotesbysree
 
Command
CommandCommand
Command
somoloye
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testing
Garuda Trainings
 
Unix
UnixUnix
An a z index of the bash commands
An a z index of the bash commandsAn a z index of the bash commands
An a z index of the bash commands
Ben Pope
 
Perintah dasar terminal kali linux
Perintah dasar terminal kali linuxPerintah dasar terminal kali linux
Perintah dasar terminal kali linux
Faizalguswanda
 
Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
nitin lakhanpal
 
Files nts
Files ntsFiles nts
Files nts
kalyani66
 
Windows command prompt a to z
Windows command prompt a to zWindows command prompt a to z
Windows command prompt a to z
Subuh Kurniawan
 
Basic Linux day 2
Basic Linux day 2Basic Linux day 2
Basic Linux day 2
Saikumar Daram
 
Basic unix commands_1
Basic unix commands_1Basic unix commands_1
Basic unix commands_1
thakor bharati
 
Lession1 Linux Preview
Lession1 Linux PreviewLession1 Linux Preview
Lession1 Linux Preview
leminhvuong
 
Bozorgmeh os lab
Bozorgmeh os labBozorgmeh os lab
Bozorgmeh os lab
FS Karimi
 
Tool Development 08 - Windows Command Prompt
Tool Development 08 - Windows Command PromptTool Development 08 - Windows Command Prompt
Tool Development 08 - Windows Command Prompt
Nick Pruehs
 
Commands and shell programming (3)
Commands and shell programming (3)Commands and shell programming (3)
Commands and shell programming (3)
christ university
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
anandvaidya
 

What's hot (20)

Unix command line concepts
Unix command line conceptsUnix command line concepts
Unix command line concepts
 
intro unix/linux 03
intro unix/linux 03intro unix/linux 03
intro unix/linux 03
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
 
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSVTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
 
Command
CommandCommand
Command
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testing
 
Unix
UnixUnix
Unix
 
An a z index of the bash commands
An a z index of the bash commandsAn a z index of the bash commands
An a z index of the bash commands
 
Perintah dasar terminal kali linux
Perintah dasar terminal kali linuxPerintah dasar terminal kali linux
Perintah dasar terminal kali linux
 
Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
 
Files nts
Files ntsFiles nts
Files nts
 
Windows command prompt a to z
Windows command prompt a to zWindows command prompt a to z
Windows command prompt a to z
 
Basic Linux day 2
Basic Linux day 2Basic Linux day 2
Basic Linux day 2
 
Basic unix commands_1
Basic unix commands_1Basic unix commands_1
Basic unix commands_1
 
Lession1 Linux Preview
Lession1 Linux PreviewLession1 Linux Preview
Lession1 Linux Preview
 
Bozorgmeh os lab
Bozorgmeh os labBozorgmeh os lab
Bozorgmeh os lab
 
Tool Development 08 - Windows Command Prompt
Tool Development 08 - Windows Command PromptTool Development 08 - Windows Command Prompt
Tool Development 08 - Windows Command Prompt
 
Commands and shell programming (3)
Commands and shell programming (3)Commands and shell programming (3)
Commands and shell programming (3)
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
 

Similar to intro unix/linux 07

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
alehegn9
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
Dheeraj Nambiar
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2
Gourav Varma
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystem
root_fibo
 
Linux file system nevigation
Linux file system nevigationLinux file system nevigation
Linux file system nevigation
hetaldobariya
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
MeesanRaza
 
Linux[122-150].pdf
Linux[122-150].pdfLinux[122-150].pdf
Linux[122-150].pdf
ZINEBAGOURRAM1
 
Linux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdfLinux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdf
AllinOne746595
 
Introduction to UNIX Command-Lines with examples
Introduction to UNIX Command-Lines with examplesIntroduction to UNIX Command-Lines with examples
Introduction to UNIX Command-Lines with examples
Noé Fernández-Pozo
 
Linux day 2.ppt
Linux day  2.pptLinux day  2.ppt
Linux day 2.ppt
Kalkey
 
LinuxLabBasics.ppt
LinuxLabBasics.pptLinuxLabBasics.ppt
LinuxLabBasics.ppt
CharuJain396881
 
Linux ppt
Linux pptLinux ppt
Linux ppt
Sanmuga Nathan
 
Introduction to linux day1
Introduction to linux day1Introduction to linux day1
Introduction to linux day1
UtpalenduChakrobortt1
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
amitkamble79
 
SGN Introduction to UNIX Command-line 2015 part 1
SGN Introduction to UNIX Command-line 2015 part 1SGN Introduction to UNIX Command-line 2015 part 1
SGN Introduction to UNIX Command-line 2015 part 1
solgenomics
 
Basics of UNIX Commands
Basics of UNIX CommandsBasics of UNIX Commands
Basics of UNIX Commands
Subra Das
 
Files and Directories in PHP
Files and Directories in PHPFiles and Directories in PHP
Files and Directories in PHP
Nicole Ryan
 
Unix training session 1
Unix training   session 1Unix training   session 1
Unix training session 1
Anil Kumar Kapil,PMP®
 
Unit 7
Unit 7Unit 7
Unit 7
siddr
 
Command Line Tools
Command Line ToolsCommand Line Tools
Command Line Tools
David Harris
 

Similar to intro unix/linux 07 (20)

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
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2
 
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
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
 
Linux[122-150].pdf
Linux[122-150].pdfLinux[122-150].pdf
Linux[122-150].pdf
 
Linux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdfLinux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdf
 
Introduction to UNIX Command-Lines with examples
Introduction to UNIX Command-Lines with examplesIntroduction to UNIX Command-Lines with examples
Introduction to UNIX Command-Lines with examples
 
Linux day 2.ppt
Linux day  2.pptLinux day  2.ppt
Linux day 2.ppt
 
LinuxLabBasics.ppt
LinuxLabBasics.pptLinuxLabBasics.ppt
LinuxLabBasics.ppt
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Introduction to linux day1
Introduction to linux day1Introduction to linux day1
Introduction to linux day1
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
 
SGN Introduction to UNIX Command-line 2015 part 1
SGN Introduction to UNIX Command-line 2015 part 1SGN Introduction to UNIX Command-line 2015 part 1
SGN Introduction to UNIX Command-line 2015 part 1
 
Basics of UNIX Commands
Basics of UNIX CommandsBasics of UNIX Commands
Basics of UNIX Commands
 
Files and Directories in PHP
Files and Directories in PHPFiles and Directories in PHP
Files and Directories in PHP
 
Unix training session 1
Unix training   session 1Unix training   session 1
Unix training session 1
 
Unit 7
Unit 7Unit 7
Unit 7
 
Command Line Tools
Command Line ToolsCommand Line Tools
Command Line Tools
 

More from duquoi

Troubleshooting CD Burning
Troubleshooting CD BurningTroubleshooting CD Burning
Troubleshooting CD Burning
duquoi
 
Advanced Bash Scripting Guide 2002
Advanced Bash Scripting Guide 2002Advanced Bash Scripting Guide 2002
Advanced Bash Scripting Guide 2002
duquoi
 
Astrolog: Switches
Astrolog: SwitchesAstrolog: Switches
Astrolog: Switches
duquoi
 
Cinelerra Video Editing Manual
Cinelerra Video Editing ManualCinelerra Video Editing Manual
Cinelerra Video Editing Manual
duquoi
 
Iptables
IptablesIptables
Iptables
duquoi
 
Ffmpeg
FfmpegFfmpeg
Ffmpeg
duquoi
 
rosegarden
rosegardenrosegarden
rosegarden
duquoi
 
intro unix/linux 12
intro unix/linux 12intro unix/linux 12
intro unix/linux 12
duquoi
 
intro unix/linux 01
intro unix/linux 01intro unix/linux 01
intro unix/linux 01
duquoi
 

More from duquoi (9)

Troubleshooting CD Burning
Troubleshooting CD BurningTroubleshooting CD Burning
Troubleshooting CD Burning
 
Advanced Bash Scripting Guide 2002
Advanced Bash Scripting Guide 2002Advanced Bash Scripting Guide 2002
Advanced Bash Scripting Guide 2002
 
Astrolog: Switches
Astrolog: SwitchesAstrolog: Switches
Astrolog: Switches
 
Cinelerra Video Editing Manual
Cinelerra Video Editing ManualCinelerra Video Editing Manual
Cinelerra Video Editing Manual
 
Iptables
IptablesIptables
Iptables
 
Ffmpeg
FfmpegFfmpeg
Ffmpeg
 
rosegarden
rosegardenrosegarden
rosegarden
 
intro unix/linux 12
intro unix/linux 12intro unix/linux 12
intro unix/linux 12
 
intro unix/linux 01
intro unix/linux 01intro unix/linux 01
intro unix/linux 01
 

Recently uploaded

Tailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer InsightsTailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer Insights
SynapseIndia
 
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and DisadvantagesBLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
SAI KAILASH R
 
Zaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdfZaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdf
AmandaCheung15
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
Zilliz
 
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
FIDO Alliance
 
kk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdfkk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdf
KIRAN KV
 
Accelerating Migrations = Recommendations
Accelerating Migrations = RecommendationsAccelerating Migrations = Recommendations
Accelerating Migrations = Recommendations
isBullShit
 
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
alexjohnson7307
 
Types of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technologyTypes of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technology
ldtexsolbl
 
Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024
siddu769252
 
Discovery Series - Zero to Hero - Task Mining Session 1
Discovery Series - Zero to Hero - Task Mining Session 1Discovery Series - Zero to Hero - Task Mining Session 1
Discovery Series - Zero to Hero - Task Mining Session 1
DianaGray10
 
Intel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdfIntel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdf
Tech Guru
 
Retrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with RagasRetrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with Ragas
Zilliz
 
Keynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive SecurityKeynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive Security
Priyanka Aash
 
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
OnBoard
 
Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17
Bhajan Mehta
 
Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10
ankush9927
 
The Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - CoatueThe Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - Coatue
Razin Mustafiz
 
Improving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning ContentImproving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning Content
Enterprise Knowledge
 
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
shanihomely
 

Recently uploaded (20)

Tailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer InsightsTailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer Insights
 
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and DisadvantagesBLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
 
Zaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdfZaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdf
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
 
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
UX Webinar Series: Drive Revenue and Decrease Costs with Passkeys for Consume...
 
kk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdfkk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdf
 
Accelerating Migrations = Recommendations
Accelerating Migrations = RecommendationsAccelerating Migrations = Recommendations
Accelerating Migrations = Recommendations
 
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
leewayhertz.com-Generative AI tech stack Frameworks infrastructure models and...
 
Types of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technologyTypes of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technology
 
Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024
 
Discovery Series - Zero to Hero - Task Mining Session 1
Discovery Series - Zero to Hero - Task Mining Session 1Discovery Series - Zero to Hero - Task Mining Session 1
Discovery Series - Zero to Hero - Task Mining Session 1
 
Intel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdfIntel Unveils Core Ultra 200V Lunar chip .pdf
Intel Unveils Core Ultra 200V Lunar chip .pdf
 
Retrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with RagasRetrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with Ragas
 
Keynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive SecurityKeynote : AI & Future Of Offensive Security
Keynote : AI & Future Of Offensive Security
 
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
Mastering Board Best Practices: Essential Skills for Effective Non-profit Lea...
 
Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17
 
Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10
 
The Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - CoatueThe Path to General-Purpose Robots - Coatue
The Path to General-Purpose Robots - Coatue
 
Improving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning ContentImproving Learning Content Efficiency with Reusable Learning Content
Improving Learning Content Efficiency with Reusable Learning Content
 
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
 

intro unix/linux 07

  • 1. Lesson 7-Creating and Changing Directories
  • 2. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files in directories. Accessing files in remote directories. Managing files from more than one directory. Moving and removing directories and their contents.
  • 3. Using Directories to Create Order A file is a collection of information stored electronically on the hard drive of a system. An inode contains all the information about each file, including the location of the actual file on the disk.
  • 4. Using Directories to Create Order The home directory. Listing files in a directory. Working with directories. Distinguishing between files and directories. Obtaining information about a directory or its contents.
  • 5. The Home Directory The “pwd” command displays the path from root to the user’s home directory. The /etc/passwd file holds the user’s home directory path. A file is created and listed in the current home directory by default.
  • 6. Listing Files in a Directory The “ls” command reads the names of the files listed in the current directory, and then outputs those names. Each file in the directory contains only the name of that file and a number that leads to the inode for that file. The “–i” option instructs ls to include the inodes in its output. Inodes are small pieces of memory created on the hard disk when it is formatted.
  • 7. Listing Files in a Directory The inode has a list of addresses of the block on the disk where the data that comprise the file is actually located. It addresses up to 13 data blocks on the hard drive. The first ten blocks addressed from the inode contains the actual file data. If a file is too large, additional blocks are allocated to fit the data.
  • 8. Working with Directories The “mkdir” command is used for creating a new directory. Directories created in uppercase are listed first by the ls command. Each new directory created is called a subdirectory. The “cd” or “change directory” command instructs the shell to locate the directory listed as an argument.
  • 9. Working with Directories The “pwd” command outputs the absolute path from the top of the file system (root or /) to the current directory. A path is a list of directory names separated by the / (slash) character. The topmost directory is called the root and is symbolized by the first forward slash (/) in the pathname.
  • 10. Working with Directories The vi editor can be used for creating a file within a directory or subdirectory. The cd command, without any directory name as an argument, returns to the home directory. The “–R” (recursive) option used with ls descends through each subdirectory in the directory tree.
  • 11. Distinguishing between Files and Directories The “ls –F” command displays directory names with a slash appended at the end. Filenames displayed with an asterisk (*) at the end are executable files. The “–C” option to ls instructs ls to make several columns in the output instead of one.
  • 12. Obtaining Information About a Directory or its Contents The “ls –l” command displays the permissions and owners of files listed in a directory. The “–d” option with ls command returns a listing of information about the contents of the target directory. The “ls –ld” displays the permissions of the directory, and not the information about the files.
  • 13. Managing Files in Directories Moving or copying files into a subdirectory. Accessing a file in a subdirectory. Avoiding mistakes when moving files into directories. Renaming files. Removing files from subdirectories.
  • 14. Moving or Copying Files into a Subdirectory Moving a file or directory does not move the file electronically. The name and the inode number are erased from the current directory and are written in the subdirectory.
  • 15. Moving or Copying Files into a Subdirectory When a file is copied, a second electronic version is created. The copied file does not have the same inode number as the original. The copied file has its own inode, permission, and data blocks containing the new files actual contents.
  • 16. Accessing a File in a Subdirectory To access a file in a subdirectory: Locate the inode number of the file. Check the permissions on the directory. Get the directory’s address from the inode. Identify the inode associated with the file. Read the files from the data blocks.
  • 17. Avoiding Mistakes When Moving Files into Directories The mv utility takes two arguments. The first argument is the name of an existing file. The second argument is a new name assigned to existing file, unless the second argument is a directory. A slash at the end of the second argument interprets the argument as a directory name.
  • 18. Renaming Files The command to move a file listing from the current directory to a new directory and also to change its filename is mv filename subdirectory/newfilename. Moving a file just moves its listing from one directory to another.
  • 19. Removing Files from Subdirectories The “rm” command can be used for removing files form a directory or subdirectory. After the rm command, the entry of the file is removed, and the data blocks listed in the inode for that file are released.
  • 20. Using Pathnames to Manage Files in Directories Accessing or creating a subdirectory. Using pathnames with utilities. Copying files into other directories using paths. Using parent directory names. Copying and moving multiple files to subdirectories. Examining the full path from root to directories and files.
  • 21. Using Pathnames to Manage Files in Directories Explicitly accessing a user’s home directory. Including other users’ logins in directory paths. Returning to the previous directory.
  • 22. Accessing or Creating a Subdirectory Providing a full path to the cd command without any spaces can access a subdirectory. Pathnames are the mechanism used to tell the shell what path to follow to access a file or directory not listed in the current directory. Remote directories can also be created by specifying the relative or absolute pathname.
  • 23. Using Pathnames with Utilities Pathnames can also be used as arguments to utilities. A relative path can be specified for accessing a file without changing the current directory.
  • 24. Copying Files into Other Directories Using Paths Pathnames are particularly useful with the “cp” and “mv” commands. Any command that takes a filename or directory name as an argument can be given an explicit pathname argument.
  • 25. Using Parent Directory Names A single dot is used for referring to the current directory. In a directory, the .. (dot-dot) is the listing for its parent directory. The parent directory is the directory located one level above the current directory.
  • 26. Using Parent Directory Names The parent directory lists the current directory’s name and inode. The . and .. are the two listings that get created when a new directory is created.
  • 27. Copying and Moving Multiple Files to Subdirectories The move and copy commands are usually used with only two arguments. The cp utility displays a usage error message when more than two arguments are specified and the last argument is not a directory. In the cp command, if the third argument specified is a directory, then the rest of the file arguments are copied into the destination subdirectory.
  • 28. Copying and Moving Multiple Files to Subdirectories The mv and cp commands can affect multiple files when the last argument is a directory. The .. (dot-dot) listing can be used in the mv command for moving files into the parent directory.
  • 29. Examining the Full Path from Root to Directories and Files A user can specify a directory’s location with the full path from the top of the file system. The full path starting at root identifies a file explicitly. The pathname for every file describes a particular file uniquely and absolutely. The full pathname to a file is called its absolute pathname.
  • 30. Explicitly Accessing a User’s Home Directory The “ls ~” command lists all filenames listed in the home directory. The C shell and all shells define the tilde (~) as the path to the user’s home directory. The shell replaces the tilde (~) with the value of the path to the user’s home directory. The shell replaces the tilde (~) in any command line with the absolute path from root to the user’s home directory.
  • 31. Including Other Users’ Logins in Directory Paths The “echo ~root” option displays the path to the home directory of the user root. The contents of the home directory of a user are displayed if the user has appropriate permissions.
  • 32. Returning to the Previous Directory The bash and ksh shells maintain the previous directory path as the value of a variable. The tcsh shell maintains a list of previous directories in a list that can be accessed. The value of the variable PWD is the path to the current directory.
  • 33. Returning to the Previous Directory An alternative way of specifying the previous directory on many bash and ksh shells is to do it with a dash argument. The exit command can be used for exiting from a child bash or ksh to the login shell. The “popd” command instructs the shell to move the directory currently on the top of the list of directories that are added to the list.
  • 34. Accessing Files in Remote Directories A filename that includes no relative path defaults to the current directory. The ./ is the default relative path that is used. Every file on the system has a unique pathname from / (root).
  • 35. Accessing Files in Remote Directories The “pwd” command displays the absolute path of the present directory. A path always starts at root (/) and includes the appropriate subdirectories.
  • 36. Managing Files from More Than One Directory A listing for a file in a directory is a link to the file. The ls –l command at the start lists the number of data blocks used by files and directories in the current directory. In a long listing entry, or record, the information for each file or directory is divided into seven fields. The second field in each entry of a file indicates the number of directories where the object is listed.
  • 37. Managing Files from More Than One Directory Linking files: The “ln” command can be used for linking a file to the current directory. The index card of each file keeps track of the number of directories that list it. Each instance of the file listed in a directory is one link. Removing a file removes it from the directory listing.
  • 38. Managing Files from More Than One Directory Linking files (continued): The ln utility can be used to link multiple files at a time. The “ls –il” command lists the current files with link count and inodes. The “–s” option to ln creates a file in the current directory that contains information required to locate the linked file.
  • 39. Managing Files from More Than One Directory Using symbolic links: A symbolic link is a small file in a directory on one file system partition that points to the correct file system and the correct inode for the linked file. In the long listing of the symbolic link, the initial character is an “l” for directories and files. An arrow and path at the end of the listing displays the actual directory where the link points.
  • 40. Managing Files from More Than One Directory Using symbolic links (continued): The ln utility provides a “–d” option for the root user to create hard links to directories. Ordinary users cannot create directory hard links. Ordinary users can create symbolic links to directories.
  • 41. Managing Files from More Than One Directory The administrator can divide the hard drive into partitions for installing the system. The partition labeled / holds the core of the hierarchal directory tree. A partition is further divided into small pieces called data blocks, which hold the actual data for the file.
  • 42. Managing Files from More Than One Directory Each partition holds a single file system and has a set of unique inode numbers for that partition. The inode contains the whole of a file, including its descriptive characteristics and the addresses of the blocks where the file data resides.
  • 43. Moving and Removing Directories and their Contents Renaming a directory only changes the name of the directory, the inode number and its location remains unchanged. A directory can also be moved from a different location in the hierarchal file structure without affecting the child contents of the directory.
  • 44. The “rmdir” command is used for removing an empty directory. The “–r” option instructs the rm command to recursively remove file. Moving and Removing Directories and their Contents
  • 45. Summary Files reside in one or more data blocks on the hard drive. Each file in a directory is assigned a unique inode. A directory is a special kind of file with very specific contents, namely the names of files and directories, each with its associated inode number. The passwd file holds the location of a user’s home directory.
  • 46. Summary The mkdir command is used for creating remote directories. The tilde (~) is interpreted as the user’s home directory. The name .. (dot-dot) is interpreted as the parent directory. The “rm –r dirname” command recursively removes the contents of the directory specified.