SlideShare a Scribd company logo
Chapter three 
Managing Files and Directories 
Prepare by zkre S Saleh 
This chapter explores the general format of your Red Hat Enterprise 
Linux system. It bridges the differences between using Nautilus to 
manage the files on your system and using a shell prompt to manage 
them. It does not go into the minute details of using a shell prompt; 
those will be covered in Chapter 4 Shell Prompt Basics. This chapter 
orients you to the system as a whole, and then you can choose which 
method of management you prefer.
File System Terms 
 extension 
An extension is that part of a filename that is found after the final ".". In the 
filename foo.txt ".txt" is the le's extension. Extensions are used to indicate le 
type. 
 path 
A path is the string of directories and sub-directories you would have to navigate 
through in order to reach a given location in the le system.
File System Terms 
 root access 
To have root access means to be logged in using the root account. This can be 
done from the main login screen, a shell prompt, or any application that requires 
your root password. Root access means that the user has permission to do 
anything on the system, so use root access with care. 
 root directory 
The root directory is the top-most directory of the le system. All other les and 
directories exist in this directory or one of its sub-directories. Do not confuse the 
root directory, /, with root's home directory, /root/.
A Larger Picture of the File System 
 Every operating system has a method of storing data in files and directories so 
that it can keep track 
 of additions, modifications, and other changes. In Red Hat Enterprise Linux, 
every file is stored in 
 a directory. Directories can also contain directories: these subdirectories may 
also contain files and 
 other subdirectories. You might think of the le system as a tree and 
directories as branches. 
 away the directories branch, everything is connected to the root directory, 
which is represented as a 
 singe forward slash (/).
Paths 
/home/user/
Managing Files 
 File Types 
 Naming Conventions 
 Finding the Correct File Extension
Managing Files 
 File Types
Managing Files 
 File Types 
Compressed and Archived Files 
.bz2. a file compressed with bzip2 
.gz. a file compressed with gzip 
. .tar. a file archived with tar (short for tape 
archive), also known as a tar file 
. .tbz or .tar.bz. a tarred and bzipped le 
. .tgz or .tar.gz. a tarred and gzipped le 
. .zip.a le compressed with ZIP compression, 
commonly found in MS-DOS applications; most 
compressed les for Linux use the gzip 
compression, so nding a .zip archive for Linux 
les is 
rare
Managing Files 
 File Types 
File Formats 
.au. an audio le 
.gif. a GIF image le (short for Graphics Interchange 
Format) 
.html or .htm. an HTML le (short for Hyper Text 
Markup Language) 
.jpg. a JPEG image le (short for Joint Photographic 
Experts Group) 
.pdf. an electronic image of a document; PDF stands for 
Portable Document Format 
.png. a PNG image le (short for Portable Network 
Graphic) 
.ps. a PostScript file; formatted for printing 
.txt. a plain ASCII text file 
.wav. an audio le 
.xpm. an image le (short for X Pixelmap)
Managing Files 
 File Types 
 Programming and Scripting Files 
.c . a C program language source code le 
.cpp . a C++ program language source 
code le 
.h . a C or C++ program language header le 
.o . a program object le 
.pl . a Perl script 
.py. a Python script 
.so . a library file 
.sh. a shell script 
.tcl . a TCL script
Managing Files 
 File Types 
 Naming Conventions 
 Finding the Correct File Extension
Managing Files 
 Naming Conventions 
 Dot Files 
 Using Spaces in File Names 
 Using Symbols in File Names 
 Files with Multiple Extensions
Managing Files 
 Naming Conventions 
 Dot Files 
 Using Spaces in File Names 
 Using Symbols in File Names 
 Files with Multiple Extensions
Managing Files 
 Naming Conventions 
 Dot Files 
 Using Spaces in File Names 
 Using Symbols in File Names 
 Files with Multiple Extensions 
Files whose name begins with a ".", called "dot" files, are 
hidden files. These files can be viewed in both graphical file 
managers like Nautilus and from the shell prompt, but require 
an extra step to reveal them. command ls –al used for view 
the hidden files in your home directory, 
How to make hidden file or 
folder ? 
Touch .extension 
Mkdir .extension
Managing Files 
 Naming Conventions 
 Dot Files 
 Using Spaces in File Names 
 Using Symbols in File Names 
 Files with Multiple Extensions 
While Linux allows file names with spaces in them, 
manipulating these files from a shell prompt can be 
quite cumbersome.
Managing Files 
 Naming Conventions 
 Dot Files 
 Using Spaces in File Names 
 Using Symbols in File 
Names 
 Files with Multiple Extensions 
It is possible to use punctuation marks in your file 
names. However, be aware that these special characters 
have special meaning to the shell and may cause errors 
at a shell prompt. It is generally recommended that you 
avoid using special characters in file names for this 
reason. If you choose to use file names with special 
characters, use quotes around the file names when 
manipulating them from a shell prompt. 
You cannot use a "/" — this indicates a directory.
Managing Files 
 Naming Conventions 
 Dot Files 
 Using Spaces in File Names 
 Using Symbols in File 
Names 
 Files with Multiple Extensions
File Compression and Archiving 
File Compression and Archiving 
It is useful to store a group of files in one file for easy backup, for 
transfer to another directory, or for transfer to another computer. It 
is also useful to compress large files; compressed files take up less 
disk space and download faster via the Internet. 
It is important to understand the distinction between an archive file 
and a compressed file. An archive file is a collection of files and 
directories stored in one file. The archive file is not compressed — 
it uses the same amount of disk space as all the individual files and 
directories combined. A compressed file is a collection of files and 
directories that are stored in one file and stored in a way that uses 
less disk space than all the individual files and directories 
combined. If disk space is a concern, compress rarely-used files, or 
place all such files in a single archive file and compress it.
File Compression and Archiving with 
GUI 
 Applications >> accessories >> archive manager
File Compression and Archiving 
 Shell prompt 
Compression Tool File 
Extension 
Decompression Tool 
bzip2 .bz2 bunzip2 
gzip .gz Gunzip 
zip .zip Unzip
File Compression and Archiving 
 Shell prompt 
Bzip2 and Bunzip2 
bzip2 filename. extinction 
bunzip2 filename.ext.bz2
File Compression and Archiving 
 Shell prompt 
gzip2 and gunzip2 
Gzip filename. extinction 
Gunzip filename.ext.gz
File Compression and Archiving 
 Shell prompt 
Zip unzip 
To compress a file with zip, enter the following command: zip -r 
filename.zip filesdir 
The -r option specifies that you want to include all files 
contained in the filesdir directory recursively. 
Zip –r filename.zip collection items 
Zip –r z.zip a b s q.png
File Compression and Archiving 
 Tar 
Tar –cvf coll.tar 1 2 3 4 5 6 dirA dirB dirC 
Filename for 
archiving
File Compression and Archiving 
List Content of tar Archive File 
Tar –tvf coll.tar 
Add Files or Directories to tar Archive File 
Tar –rvf coll.tar 1 2 3 4 5 6 
Check the Size of the tar, tar.gz and tar.bz2 Archive File 
Tar –czf – coll.tar | wc -c
File Compression and Archiving 
 Tar 
Compression and Archiving 
z.Tar >>>> z.tar.gz 
Gzip z.tar
Managing Files and Directories 
 Creating Directories 
 Deleting Directories 
 Dot Directories . 
 
Right-click on Desktop 
select Create Folder 
Change name with you want 
To create a new directory using a shell prompt, use the 
command mkdir. Enter: mkdir
Managing Files and Directories 
 Creating Directories 
 Deleting Directories 
 Dot Directories . 
 
right click on it and choose Move to Trash, or click and drag 
the icon to the Trash on the Desktop. 
To delete an empty directory from a shell prompt, enter the 
command rmdir. 
To delete a directory that may not be empty (and consequently 
everything inside that directory), enter the command rm - rf 
<directory>.
Managing Files and Directories 
 Creating Directories 
 Deleting Directories 
 Dot Directories 
 
Mkdir .name
Thank you for watched

More Related Content

PPT
3. distributed file system requirements
PPTX
System and network administration network services
PPTX
Linux User Management
PPTX
IP tables and Filtering
PPTX
Python-Inheritance.pptx
PDF
Users and groups in Linux
PDF
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
PPTX
directory structure and file system mounting
3. distributed file system requirements
System and network administration network services
Linux User Management
IP tables and Filtering
Python-Inheritance.pptx
Users and groups in Linux
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
directory structure and file system mounting

What's hot (20)

PDF
CSI-503 - 11.Distributed Operating System
PPTX
RPC: Remote procedure call
PPTX
8 queens problem using back tracking
ODP
Apache ppt
PPT
Presentation On RAID(Redundant Array Of Independent Disks) Basics
PPTX
Cloud File System with GFS and HDFS
PPT
Cloud Computing Security Challenges
PPT
PPS
Introduction to Mysql
PPT
Clock synchronization in distributed system
PPTX
Linux network file system (nfs)
PPTX
File Handling Python
PDF
Cloud Computing and Virtualization
PPT
Cluster Computing
PPT
Layered Architecture
PPTX
Database architecture
PPTX
Operator Overloading In Python
PPTX
Distributed database management system
PPT
Xml 215-presentation
CSI-503 - 11.Distributed Operating System
RPC: Remote procedure call
8 queens problem using back tracking
Apache ppt
Presentation On RAID(Redundant Array Of Independent Disks) Basics
Cloud File System with GFS and HDFS
Cloud Computing Security Challenges
Introduction to Mysql
Clock synchronization in distributed system
Linux network file system (nfs)
File Handling Python
Cloud Computing and Virtualization
Cluster Computing
Layered Architecture
Database architecture
Operator Overloading In Python
Distributed database management system
Xml 215-presentation
Ad

Viewers also liked (20)

PDF
Linux Directory Structure
PPT
File management ppt
PPTX
File management
PDF
Linux File System
PPTX
Operating Systems - File Management
PPT
Unix and Linux
PDF
Booting & shut down,
PDF
Linux Directory Structure
PDF
LINUX Admin Quick Reference
PDF
Linux system administration
PPTX
PPTX
FTP Server
PPTX
Linux files
PDF
Linux-Permission
DOCX
The linux file system structure
PPTX
Double level directory structure 55(1)
PPTX
File permissions
PPT
Kernal
PPT
Mca ii os u-5 unix linux file system
PPT
Fat and ntfs
Linux Directory Structure
File management ppt
File management
Linux File System
Operating Systems - File Management
Unix and Linux
Booting & shut down,
Linux Directory Structure
LINUX Admin Quick Reference
Linux system administration
FTP Server
Linux files
Linux-Permission
The linux file system structure
Double level directory structure 55(1)
File permissions
Kernal
Mca ii os u-5 unix linux file system
Fat and ntfs
Ad

Similar to Management file and directory in linux (20)

PDF
Unix primer
PPT
101 3.3 perform basic file management
DOCX
Directories description
PPT
intro unix/linux 07
PDF
Course 102: Lecture 24: Archiving and Compression of Files
PDF
Linux fundamental - Chap 03 file
PPTX
Unix training session 1
PDF
Lecture1 2 intro-unix
PDF
Managing your data - Introduction to Linux for bioinformatics
PDF
Command Line Tools
PPT
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
PDF
Part 4 of 'Introduction to Linux for bioinformatics': Managing data
PPTX
Linux Commands.pptx
PPTX
12 linux archiving tools
DOC
Treebeard's Unix Cheat Sheet
PPTX
Chapter 2 Linux File System and net.pptx
PPTX
Similarities between linux & windows administration
PDF
Linux_Ch2 Lecture (1).pdf
PPT
03 browsing the filesystem
PDF
Find and Locate: Two Commands
Unix primer
101 3.3 perform basic file management
Directories description
intro unix/linux 07
Course 102: Lecture 24: Archiving and Compression of Files
Linux fundamental - Chap 03 file
Unix training session 1
Lecture1 2 intro-unix
Managing your data - Introduction to Linux for bioinformatics
Command Line Tools
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
Part 4 of 'Introduction to Linux for bioinformatics': Managing data
Linux Commands.pptx
12 linux archiving tools
Treebeard's Unix Cheat Sheet
Chapter 2 Linux File System and net.pptx
Similarities between linux & windows administration
Linux_Ch2 Lecture (1).pdf
03 browsing the filesystem
Find and Locate: Two Commands

Recently uploaded (20)

PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Construction Project Organization Group 2.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Sustainable Sites - Green Building Construction
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Digital Logic Computer Design lecture notes
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
PPT on Performance Review to get promotions
PPTX
Welding lecture in detail for understanding
DOCX
573137875-Attendance-Management-System-original
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Operating System & Kernel Study Guide-1 - converted.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Construction Project Organization Group 2.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Sustainable Sites - Green Building Construction
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
OOP with Java - Java Introduction (Basics)
Digital Logic Computer Design lecture notes
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Embodied AI: Ushering in the Next Era of Intelligent Systems
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
bas. eng. economics group 4 presentation 1.pptx
PPT on Performance Review to get promotions
Welding lecture in detail for understanding
573137875-Attendance-Management-System-original
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf

Management file and directory in linux

  • 1. Chapter three Managing Files and Directories Prepare by zkre S Saleh This chapter explores the general format of your Red Hat Enterprise Linux system. It bridges the differences between using Nautilus to manage the files on your system and using a shell prompt to manage them. It does not go into the minute details of using a shell prompt; those will be covered in Chapter 4 Shell Prompt Basics. This chapter orients you to the system as a whole, and then you can choose which method of management you prefer.
  • 2. File System Terms  extension An extension is that part of a filename that is found after the final ".". In the filename foo.txt ".txt" is the le's extension. Extensions are used to indicate le type.  path A path is the string of directories and sub-directories you would have to navigate through in order to reach a given location in the le system.
  • 3. File System Terms  root access To have root access means to be logged in using the root account. This can be done from the main login screen, a shell prompt, or any application that requires your root password. Root access means that the user has permission to do anything on the system, so use root access with care.  root directory The root directory is the top-most directory of the le system. All other les and directories exist in this directory or one of its sub-directories. Do not confuse the root directory, /, with root's home directory, /root/.
  • 4. A Larger Picture of the File System  Every operating system has a method of storing data in files and directories so that it can keep track  of additions, modifications, and other changes. In Red Hat Enterprise Linux, every file is stored in  a directory. Directories can also contain directories: these subdirectories may also contain files and  other subdirectories. You might think of the le system as a tree and directories as branches.  away the directories branch, everything is connected to the root directory, which is represented as a  singe forward slash (/).
  • 6. Managing Files  File Types  Naming Conventions  Finding the Correct File Extension
  • 7. Managing Files  File Types
  • 8. Managing Files  File Types Compressed and Archived Files .bz2. a file compressed with bzip2 .gz. a file compressed with gzip . .tar. a file archived with tar (short for tape archive), also known as a tar file . .tbz or .tar.bz. a tarred and bzipped le . .tgz or .tar.gz. a tarred and gzipped le . .zip.a le compressed with ZIP compression, commonly found in MS-DOS applications; most compressed les for Linux use the gzip compression, so nding a .zip archive for Linux les is rare
  • 9. Managing Files  File Types File Formats .au. an audio le .gif. a GIF image le (short for Graphics Interchange Format) .html or .htm. an HTML le (short for Hyper Text Markup Language) .jpg. a JPEG image le (short for Joint Photographic Experts Group) .pdf. an electronic image of a document; PDF stands for Portable Document Format .png. a PNG image le (short for Portable Network Graphic) .ps. a PostScript file; formatted for printing .txt. a plain ASCII text file .wav. an audio le .xpm. an image le (short for X Pixelmap)
  • 10. Managing Files  File Types  Programming and Scripting Files .c . a C program language source code le .cpp . a C++ program language source code le .h . a C or C++ program language header le .o . a program object le .pl . a Perl script .py. a Python script .so . a library file .sh. a shell script .tcl . a TCL script
  • 11. Managing Files  File Types  Naming Conventions  Finding the Correct File Extension
  • 12. Managing Files  Naming Conventions  Dot Files  Using Spaces in File Names  Using Symbols in File Names  Files with Multiple Extensions
  • 13. Managing Files  Naming Conventions  Dot Files  Using Spaces in File Names  Using Symbols in File Names  Files with Multiple Extensions
  • 14. Managing Files  Naming Conventions  Dot Files  Using Spaces in File Names  Using Symbols in File Names  Files with Multiple Extensions Files whose name begins with a ".", called "dot" files, are hidden files. These files can be viewed in both graphical file managers like Nautilus and from the shell prompt, but require an extra step to reveal them. command ls –al used for view the hidden files in your home directory, How to make hidden file or folder ? Touch .extension Mkdir .extension
  • 15. Managing Files  Naming Conventions  Dot Files  Using Spaces in File Names  Using Symbols in File Names  Files with Multiple Extensions While Linux allows file names with spaces in them, manipulating these files from a shell prompt can be quite cumbersome.
  • 16. Managing Files  Naming Conventions  Dot Files  Using Spaces in File Names  Using Symbols in File Names  Files with Multiple Extensions It is possible to use punctuation marks in your file names. However, be aware that these special characters have special meaning to the shell and may cause errors at a shell prompt. It is generally recommended that you avoid using special characters in file names for this reason. If you choose to use file names with special characters, use quotes around the file names when manipulating them from a shell prompt. You cannot use a "/" — this indicates a directory.
  • 17. Managing Files  Naming Conventions  Dot Files  Using Spaces in File Names  Using Symbols in File Names  Files with Multiple Extensions
  • 18. File Compression and Archiving File Compression and Archiving It is useful to store a group of files in one file for easy backup, for transfer to another directory, or for transfer to another computer. It is also useful to compress large files; compressed files take up less disk space and download faster via the Internet. It is important to understand the distinction between an archive file and a compressed file. An archive file is a collection of files and directories stored in one file. The archive file is not compressed — it uses the same amount of disk space as all the individual files and directories combined. A compressed file is a collection of files and directories that are stored in one file and stored in a way that uses less disk space than all the individual files and directories combined. If disk space is a concern, compress rarely-used files, or place all such files in a single archive file and compress it.
  • 19. File Compression and Archiving with GUI  Applications >> accessories >> archive manager
  • 20. File Compression and Archiving  Shell prompt Compression Tool File Extension Decompression Tool bzip2 .bz2 bunzip2 gzip .gz Gunzip zip .zip Unzip
  • 21. File Compression and Archiving  Shell prompt Bzip2 and Bunzip2 bzip2 filename. extinction bunzip2 filename.ext.bz2
  • 22. File Compression and Archiving  Shell prompt gzip2 and gunzip2 Gzip filename. extinction Gunzip filename.ext.gz
  • 23. File Compression and Archiving  Shell prompt Zip unzip To compress a file with zip, enter the following command: zip -r filename.zip filesdir The -r option specifies that you want to include all files contained in the filesdir directory recursively. Zip –r filename.zip collection items Zip –r z.zip a b s q.png
  • 24. File Compression and Archiving  Tar Tar –cvf coll.tar 1 2 3 4 5 6 dirA dirB dirC Filename for archiving
  • 25. File Compression and Archiving List Content of tar Archive File Tar –tvf coll.tar Add Files or Directories to tar Archive File Tar –rvf coll.tar 1 2 3 4 5 6 Check the Size of the tar, tar.gz and tar.bz2 Archive File Tar –czf – coll.tar | wc -c
  • 26. File Compression and Archiving  Tar Compression and Archiving z.Tar >>>> z.tar.gz Gzip z.tar
  • 27. Managing Files and Directories  Creating Directories  Deleting Directories  Dot Directories .  Right-click on Desktop select Create Folder Change name with you want To create a new directory using a shell prompt, use the command mkdir. Enter: mkdir
  • 28. Managing Files and Directories  Creating Directories  Deleting Directories  Dot Directories .  right click on it and choose Move to Trash, or click and drag the icon to the Trash on the Desktop. To delete an empty directory from a shell prompt, enter the command rmdir. To delete a directory that may not be empty (and consequently everything inside that directory), enter the command rm - rf <directory>.
  • 29. Managing Files and Directories  Creating Directories  Deleting Directories  Dot Directories  Mkdir .name
  • 30. Thank you for watched

Editor's Notes

  • #22: Here class A stop
  • #25: Here A class stop
  • #26:  Add Files or Directories to tar Archive File