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

ODP
Apache ppt
PPTX
Networking in linux
PDF
package mangement
PPTX
Windows Network concepts
PDF
Linux systems - Linux Commands and Shell Scripting
PDF
Introduction to Web Services
PPTX
ODP
Linux commands
Apache ppt
Networking in linux
package mangement
Windows Network concepts
Linux systems - Linux Commands and Shell Scripting
Introduction to Web Services
Linux commands

What's hot (20)

PPT
Linux file system
PPTX
File system Os
PDF
Django Tutorial | Django Web Development With Python | Django Training and Ce...
PPT
Domain name system
PPTX
Linux process management
PPTX
Basic commands of linux
PPT
Linux architecture
PPTX
User management
PPT
2.1 users & groups
PPT
Linux command ppt
ODP
Graphics & Animation with HTML5
PPTX
Windows server
PPTX
Bash shell scripting
PPTX
Cloud Computing and Services | PPT
PDF
WT(WEB TECHNOLOGY) previous year question papers
PPT
Linux basic commands
ODP
Linux Introduction (Commands)
PPT
Samba server
PDF
Shell scripting
Linux file system
File system Os
Django Tutorial | Django Web Development With Python | Django Training and Ce...
Domain name system
Linux process management
Basic commands of linux
Linux architecture
User management
2.1 users & groups
Linux command ppt
Graphics & Animation with HTML5
Windows server
Bash shell scripting
Cloud Computing and Services | PPT
WT(WEB TECHNOLOGY) previous year question papers
Linux basic commands
Linux Introduction (Commands)
Samba server
Shell scripting
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)

PPT
linux-file-system01.ppt
PPT
managing-the-linux-file-system_suse_.ppt
PPT
managing-the-linux-file-system________________________
PPT
Edubooktraining
PPTX
Linux 4 you
PDF
File system discovery
ODP
Nguyễn Vũ Hưng: Basic Linux Power Tools
PDF
Command Line Tools
PPT
PPTX
Degonto, File management system in fisheries science
PPTX
Linux day 2.ppt
PPT
Unix/Linux Basic Commands and Shell Script
PPTX
File Management
PPTX
File Management
PDF
Unit3 browsing the filesystem
PPTX
Introduction to linux2
PDF
beginner.en.print
PDF
beginner.en.print
PDF
beginner.en.print
PDF
Operating System Practice : Meeting 4 - operasi file dan struktur direktori-s...
linux-file-system01.ppt
managing-the-linux-file-system_suse_.ppt
managing-the-linux-file-system________________________
Edubooktraining
Linux 4 you
File system discovery
Nguyễn Vũ Hưng: Basic Linux Power Tools
Command Line Tools
Degonto, File management system in fisheries science
Linux day 2.ppt
Unix/Linux Basic Commands and Shell Script
File Management
File Management
Unit3 browsing the filesystem
Introduction to linux2
beginner.en.print
beginner.en.print
beginner.en.print
Operating System Practice : Meeting 4 - operasi file dan struktur direktori-s...

Recently uploaded (20)

PDF
Using Technology to Foster Innovative Teaching Practices (www.kiu.ac.ug)
PPTX
Real Estate Management PART 1.pptxFFFFFFFFFFFFF
PPTX
Wireless sensor networks (WSN) SRM unit 2
PPTX
22ME926Introduction to Business Intelligence and Analytics, Advanced Integrat...
PPT
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt
PDF
IAE-V2500 Engine Airbus Family A319/320
PDF
LS-6-Digital-Literacy (1) K12 CURRICULUM .pdf
DOCX
ENVIRONMENTAL PROTECTION AND MANAGEMENT (18CVL756)
PDF
Mechanics of materials week 2 rajeshwari
PDF
Engineering Solutions for Ethical Dilemmas in Healthcare (www.kiu.ac.ug)
PDF
ASPEN PLUS USER GUIDE - PROCESS SIMULATIONS
PPTX
Research Writing, Mechanical Engineering
PPTX
chapter 1.pptx dotnet technology introduction
PDF
AIGA 012_04 Cleaning of equipment for oxygen service_reformat Jan 12.pdf
PDF
Artificial Intelligence_ Basics .Artificial Intelligence_ Basics .
PPT
Programmable Logic Controller PLC and Industrial Automation
PPTX
AI-Reporting for Emerging Technologies(BS Computer Engineering)
PDF
B461227.pdf American Journal of Multidisciplinary Research and Review
PDF
Module 1 part 1.pdf engineering notes s7
PPT
Comprehensive Java Training Deck - Advanced topics
Using Technology to Foster Innovative Teaching Practices (www.kiu.ac.ug)
Real Estate Management PART 1.pptxFFFFFFFFFFFFF
Wireless sensor networks (WSN) SRM unit 2
22ME926Introduction to Business Intelligence and Analytics, Advanced Integrat...
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt
IAE-V2500 Engine Airbus Family A319/320
LS-6-Digital-Literacy (1) K12 CURRICULUM .pdf
ENVIRONMENTAL PROTECTION AND MANAGEMENT (18CVL756)
Mechanics of materials week 2 rajeshwari
Engineering Solutions for Ethical Dilemmas in Healthcare (www.kiu.ac.ug)
ASPEN PLUS USER GUIDE - PROCESS SIMULATIONS
Research Writing, Mechanical Engineering
chapter 1.pptx dotnet technology introduction
AIGA 012_04 Cleaning of equipment for oxygen service_reformat Jan 12.pdf
Artificial Intelligence_ Basics .Artificial Intelligence_ Basics .
Programmable Logic Controller PLC and Industrial Automation
AI-Reporting for Emerging Technologies(BS Computer Engineering)
B461227.pdf American Journal of Multidisciplinary Research and Review
Module 1 part 1.pdf engineering notes s7
Comprehensive Java Training Deck - Advanced topics

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