SlideShare a Scribd company logo
1 of 17
Junior Level Linux Certification
Exam Objectives
Key Knowledge Areas
Copy, move and remove files and directories individually.
Copy multiple files and directories recursively.
Remove files and directories recursively.
Use simple and advanced wildcard specifications in commands.
Using find to locate and act on files based on type, size, or time.
Usage of tar, cpio and dd.
Objective 3: GNU and Unix Commands
Perform basic file management Weight: 4
Terms and Utilities
Cp find mkdir
mv ls rm
rmdir touch tar
cpio dd file
gzip gunzip bzip2
file globbing
2
Process text streams using filters
Rundown of commands
commands Overview
3
cp - copy files
find - find files based on command line specifications
mkdir - make a directory
mv - move or rename files and directories
ls - list files
rm - remove files (and directories, if you ask nicely)
rmdir - remove directory
touch - touch a file to update its timestamp
file globbing - *, ?, [abc] and {abc,def} wildcards
basic file management
ls - lists the contents of directories
Files, directories and ls
4
In output of ls, the meaning of columns left to right are:
•file type and permissions (d – directory, l – symbolic link, r – read, w – write, x –executable or searchable)
•number of links to the file
•user name
•group name
•size (in bytes)
•date
•time
•file name
After file name may print additional info. “/” – it's a directory, “*”– it's executable, “>somewhere” it‘s symbolic link
bar@foo:~> cd /etc/ppp/
bar@foo:/etc/ppp> ls -la
total 68
drwxr-x--- 5 root dialout 4096 2003-05-12 12:36 ./
drwxr-xr-x 53 root root 8192 2003-06-04 10:51 ../
lrwxrwxrwx 1 root root 5 2003-03-03 11:09 ip-down -> ipup*
drwxr-xr-x 2 root root 4096 2002-09-10 19:40 ip-down.d/
-rwxr-xr-x 1 root root 9038 2002-09-10 19:40 ip-up*
drwxr-xr-x 2 root root 4096 2002-09-10 19:40 ip-up.d/
-rw-r--r-- 1 root root 8121 2002-09-09 22:32 options
-rw------- 1 root root 1219 2002-09-09 22:32 pap-secrets
#type+perm link user group size date time name
Ex:
basic file management
special characters and strings that can take the place of any characters, or specific characters.
File globbing (wildcards)
5
foo:/etc $ ls -l host*
-rw-r--r-- 1 root root 17 Jul 23 2000 host.conf
-rw-rw-r-- 2 root root 291 Mar 31 15:03 hosts
-rw-r--r-- 1 root root 201 Feb 13 21:05 hosts.allow
-rw-rw-r-- 1 root root 196 Dec 9 15:06 hosts.bak
-rw-r--r-- 1 root root 357 Jan 23 19:39 hosts.deny
foo:/etc $ ls [A-Z]* -lad
drwxr-xr-x 3 root root 4096 Oct 14 11:07 CORBA
-rw-r--r-- 1 root root 2434 Sep 2 2002 DIR_COLORS
-rw-r--r-- 1 root root 2434 Sep 2 2002 DIR_COLORS.xterm
-rw-r--r-- 1 root root 92336 Jun 23 2002 Muttrc
drwxr-xr-x 18 root root 4096 Feb 24 19:54 X11
Ex:
shell expands the following special characters just in case they are part of a file name.
Filename expansion is only performed if the special characters are in quote
~ /home/user or /root (the user's home directory) echo ~/.bashrc
* Any sequence of characters (or no characters) echo /etc/*ost*
? Any one character echo /etc/hos?
[abc] Any of a, b, or c echo /etc/host[s.]
{abc,def,ghi} Any of abc, def or ghi echo /etc/hosts.{allow,deny}
basic file management
mkdir – make directory
Directories and files
6
[jack@foo tmp]$ mkdir dir1
[jack@foo tmp]$ mkdir dir2 dir3
[jack@foo tmp]$ ls -la
total 20
drwxrwxr-x 5 jack jack 4096 Apr 8 10:00 .
drwxr-xr-x 12 jack users 4096 Apr 8 10:00 ..
drwxrwxr-x 2 jack jack 4096 Apr 8 10:00 dir1
drwxrwxr-x 2 jack jack 4096 Apr 8 10:00 dir2
drwxrwxr-x 2 jack jack 4096 Apr 8 10:00 dir3
[jack@foo tmp]$ mkdir parent/sub/something
mkdir: cannot create directory `parent/sub/something': No such file
or directory
[jack@foo tmp]$ mkdir -p parent/sub/something
[jack@foo tmp]$ find
.
./dir1
./dir2
./dir3
./parent
./parent/sub
./parent/sub/something
Ex:
To make directory, use mkdir. By default, parent directory must exist, but with the -p switch mkdir will
also create the required parent directories.
basic file management
Permissions for a new directory are determined by the umask value, unless you set them
manually using the -m switch.
Directories and files
7
umask Directory mode Directory mode
000 0777 drwxrwxrwx
002 0775 drwxrwxr-x
022 0755 drwxr-xr-x
027 0750 drwxr-x---
basic file management
rmdir – remove directory
Directories and files
8
[jack@foo tmp]$ rmdir dir1
[jack@foo tmp]$ rmdir dir2 dir3
[jack@foo tmp]$ rmdir parent
rmdir: `parent': Directory not empty
[jack@foo tmp]$ rmdir parent/sub/something/
[jack@foo tmp]$ rmdir parent
rmdir: `parent': Directory not empty
[jack@foo tmp]$ rmdir parent/sub
[jack@foo tmp]$ rmdir parent
[jack@foo tmp]$ find
.
[jack@foo tmp]$ rmdir /etc
rmdir: `/etc': Permission denied
Ex:
rmdir can be used to remove empty directories. If directory contains any files and directories, it will fail.
(rm -r can remove).
basic file management
touch – update a file's time stamp
Directories and files
9
[jack@foo tmp]$ mkdir dir4
[jack@foo tmp]$ cd dir4
[jack@foo dir4]$ ls -l
total 0
[jack@foo dir4]$ touch newfile
[jack@foo dir4]$ ls -l
total 0
-rw-rw-r-- 1 jack jack 0 Apr 8 10:28 newfile
Ex:
originally written to update the time stamp of files. However, due to programming error, touch would create an empty file if it did not
exist. By the time this error was discovered, people were using touch to create empty files, and this is now an accepted use of touch.
[jack@foo dir4]$ touch newfile
[jack@foo dir4]$ ls -l
total 0
-rw-rw-r-- 1 jack jack 0 Apr 8 10:29 newfile
The second time we run touch it updates the file time
basic file management
Directories and files
10
Ex: [jack@foo dir4]$ touch file-{one,two}-{a,b}
[jack@foo dir4]$ ls –l
total 0
-rw-rw-r-- 1 jack jack 0 Apr 8 10:33 file-one-a
-rw-rw-r-- 1 jack jack 0 Apr 8 10:33 file-one-b
-rw-rw-r-- 1 jack jack 0 Apr 8 10:33 file-two-a
-rw-rw-r-- 1 jack jack 0 Apr 8 10:33 file-two-b
-rw-rw-r-- 1 jack jack 0 Apr 8 10:29 newfile
touch can create more than one file at a time
basic file management
rm – remove files
Directories and files
11
[hack@foo dir4]$ cd ..
[hack@foo tmp]$ ls dir4/
file-one-a file-one-b file-two-a file-two-b newfile
[hack@foo tmp]$ rm dir4/file*a
[hack@foo tmp]$ ls dir4/
file-one-b file-two-b newfile
Ex:
[hack@foo tmp]$ rm -ri dir4
rm: descend into directory `dir4'? y
rm: remove regular empty file `dir4/newfile'? y
rm: remove regular empty file `dir4/file-one-b'? y
rm: remove regular empty file `dir4/file-two-b'? y
rm: remove directory `dir4'? y
rm -r can be used to remove directories and the files contained in them.
rm -i to specify interactive behaviour (confirmation before removal).
Ex:
rm -rf is used to remove directories and their files without prompting
[hack@foo tmp]$ rm -rf dir4
Ex:
basic file management
cp – copy files
Copying and moving
12
[[jack@foo jack]$ ls
[jack@foo jack]$ cp /etc/passwd .
[jack@foo jack]$ ls
passwd
copying a file (/etc/passwd) to a directory (.)Ex:
cp -v is verbose about the progress of the copying process.
[jack@foo jack]$ mkdir copybin
[jack@foo jack]$ cp /bin/* ./copybin
[jack@foo jack]$ cp -v /bin/* ./copybin
`/bin/arch' -> `./copybin/arch'
`/bin/ash' -> `./copybin/ash'
`/bin/ash.static' -> `./copybin/ash.static'
`/bin/aumix-minimal' -> `./copybin/aumix-minimal'
`/bin/awk' -> `./copybin/awk'
Ex:
cp has 2 modes of usage:
1.Copy one or more files to a directory – cp file1 file2 file3 /home/user/directory/
2.Copy a file and to a new file name – cp file1 file13
If there are more than 2 parameters given to cp, then last parameter is always the destination directory.
basic file management
mv – move or rename files
Copying and moving
13
[jack@foo jack]$ mkdir fred
[jack@foo jack]$ mv -v fred joe
`fred' -> `joe'
[jack@foo jack]$ cp -v /etc/passwd joe/
`/etc/passwd' -> `joe/passwd'
[jack@foo jack]$ mv -v joe/passwd .
`joe/passwd' -> `./passwd'
use -v so that mv is verbose.Ex:
mv is the command used for renaming files
[jack@foo jack]$ mv -v passwd ichangedthenamehaha
`passwd' -> `ichangedthenamehaha'
[jack@foo jack]$ cp /etc/services .
Ex:
mv (like cp) has 2 modes of operation:
1.Move one or more files to a directory – mv file1 file2 file3 /home/user/directory/
2.Move a file and to a new file name (rename) – mv file1 file13
If there are more than 2 parameters given to mv, then last parameter is always the destination
directory.
basic file management
find – able to find files
find
14
[jack@tonto jack]$ find /usr/share/doc/unzip-5.50/ /etc/skel/
/usr/share/doc/unzip-5.50/
/usr/share/doc/unzip-5.50/BUGS
/usr/share/doc/unzip-5.50/INSTALL
/usr/share/doc/unzip-5.50/LICENSE
/usr/share/doc/unzip-5.50/README
/etc/skel/
/etc/skel/.kde
/etc/skel/.kde/Autostart
/etc/skel/.kde/Autostart/Autorun.desktop
/etc/skel/.kde/Autostart/.directory
/etc/skel/.bash_logout
/etc/skel/.bash_profile
.. // ..
Ex:
Conditions to find files:
• have names that contain certain text or match a given pattern
• are links to specific files
• were last used during a given period of time
• are within a given range of size
• are of a specified type (normal file, directory, symbolic link, etc.)
• are owned by a certain user or group or have specified permissions.
Simplest way of using is to specify a list of directories for find to search. By default find prints the name of each file it finds.
basic file management
find is usually used to search based on particular criteria:
find
15
Test Meaning Example
-name » find based on the file's name find /bin /usr/bin -name 'ch*‘
-iname » case insensitive file name find /etc -iname '*pass*‘
-ctime » find based on the time that the file was find /home -ctime +365
-mtime created, or last modified, or last accessed find /var/log -mtime -l
-atime find /tmp -atime +30
-group » find based on the group or user of the file find /tmp -user `whoami`
-user
-uid find /tmp -uid `id -u`
-gid
-perm » find based on the file permissions find /usr/bin -perm -4001
(exactly, or +including, or all) find /etc -type f -perm +111
-size » find files of a particular size find / -size +5000k
-type » find files, director., pipes, sockets, links find /dev /var -type p
basic file management
find -exec
find
16
foo:~ $ find /bin -perm -4001 -exec ls -lad {} ;
-rwsr-xr-x 1 root root 35302 Jun 23 2002 /bin/ping
-rwsr-xr-x 1 root root 81996 Aug 30 2002 /bin/mount
-rwsr-xr-x 1 root root 40700 Aug 30 2002 /bin/umount
-rwsr-xr-x 1 root root 19132 Aug 29 2002 /bin/su
Ex:
When find finds a file, default action is to print out file's name.
•Alternative action that is quite useful is find –exec:
•find executes the specified program, passing the file name to it.
•find substitutes the name of the command in the place of the special characters {}.
•The command must end with “;” which must be quoted so that it is not interpreted by the shell.
Fim de sessão
17

More Related Content

What's hot (20)

Know the UNIX Commands
Know the UNIX CommandsKnow the UNIX Commands
Know the UNIX Commands
 
Linux
LinuxLinux
Linux
 
Compression
CompressionCompression
Compression
 
Linux
Linux Linux
Linux
 
Linux commands
Linux commands Linux commands
Linux commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Command Line Tools
Command Line ToolsCommand Line Tools
Command Line Tools
 
Unix slideshare
Unix slideshareUnix slideshare
Unix slideshare
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirects101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirects
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
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
LinuxLinux
Linux
 
Basic Unix
Basic UnixBasic Unix
Basic Unix
 
Directories description
Directories descriptionDirectories description
Directories description
 
Basic Linux day 2
Basic Linux day 2Basic Linux day 2
Basic Linux day 2
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux Command Line Basics
Linux Command Line BasicsLinux Command Line Basics
Linux Command Line Basics
 
Linux command for beginners
Linux command for beginnersLinux command for beginners
Linux command for beginners
 

Viewers also liked

Number Of Things
Number Of ThingsNumber Of Things
Number Of Thingsad3pic
 
The Gory Details of Debian packages
The Gory Details of Debian packagesThe Gory Details of Debian packages
The Gory Details of Debian packagesJeremiah Foster
 
Understanding Debian Packages (2014)
Understanding Debian Packages (2014)Understanding Debian Packages (2014)
Understanding Debian Packages (2014)Miriam Ruiz
 
aptly: Debian repository management tool
aptly: Debian repository management toolaptly: Debian repository management tool
aptly: Debian repository management toolAndrey Smirnov
 
Lpi 101 study_guide
Lpi 101 study_guideLpi 101 study_guide
Lpi 101 study_guideousman1
 
Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTJoshua Thijssen
 
Installing Software, Part 2: Package Managers
Installing Software, Part 2: Package ManagersInstalling Software, Part 2: Package Managers
Installing Software, Part 2: Package ManagersKevin OBrien
 
Linux training
Linux trainingLinux training
Linux trainingartisriva
 
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package managementAcácio Oliveira
 
RPM (Red Hat Package Manager)
RPM (Red Hat Package Manager)RPM (Red Hat Package Manager)
RPM (Red Hat Package Manager)skalaivanibutp
 
Linux process management
Linux process managementLinux process management
Linux process managementRaghu nath
 

Viewers also liked (18)

Number Of Things
Number Of ThingsNumber Of Things
Number Of Things
 
Temporary
TemporaryTemporary
Temporary
 
Portfolio May09.Ppt
Portfolio May09.PptPortfolio May09.Ppt
Portfolio May09.Ppt
 
Advertising
AdvertisingAdvertising
Advertising
 
Innovative technologies in agri-horticulture and agroprocessing for enhancing...
Innovative technologies in agri-horticulture and agroprocessing for enhancing...Innovative technologies in agri-horticulture and agroprocessing for enhancing...
Innovative technologies in agri-horticulture and agroprocessing for enhancing...
 
The Gory Details of Debian packages
The Gory Details of Debian packagesThe Gory Details of Debian packages
The Gory Details of Debian packages
 
Understanding Debian Packages (2014)
Understanding Debian Packages (2014)Understanding Debian Packages (2014)
Understanding Debian Packages (2014)
 
Linux cheat sheet
Linux cheat sheetLinux cheat sheet
Linux cheat sheet
 
aptly: Debian repository management tool
aptly: Debian repository management toolaptly: Debian repository management tool
aptly: Debian repository management tool
 
Lpi 101 study_guide
Lpi 101 study_guideLpi 101 study_guide
Lpi 101 study_guide
 
Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APT
 
Installing Software, Part 2: Package Managers
Installing Software, Part 2: Package ManagersInstalling Software, Part 2: Package Managers
Installing Software, Part 2: Package Managers
 
Linux training
Linux trainingLinux training
Linux training
 
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
 
RPM (Red Hat Package Manager)
RPM (Red Hat Package Manager)RPM (Red Hat Package Manager)
RPM (Red Hat Package Manager)
 
Linux for Librarians
Linux for LibrariansLinux for Librarians
Linux for Librarians
 
RPM (LINUX)
RPM (LINUX)RPM (LINUX)
RPM (LINUX)
 
Linux process management
Linux process managementLinux process management
Linux process management
 

Similar to 101 3.3 perform basic file management

101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file managementAcácio Oliveira
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file managementAcácio Oliveira
 
3.3 perform basic file management
3.3 perform basic file management3.3 perform basic file management
3.3 perform basic file managementAcácio Oliveira
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic CommandsHanan Nmr
 
The Linux Command Cheat Sheet
The Linux Command Cheat SheetThe Linux Command Cheat Sheet
The Linux Command Cheat SheetTola LENG
 
Basic shell commands by Jeremy Sanders
Basic shell commands by Jeremy SandersBasic shell commands by Jeremy Sanders
Basic shell commands by Jeremy SandersDevanand Gehlot
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdfamitkamble79
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentalsDima Gomaa
 
3.1.a linux commands reference
3.1.a linux commands reference3.1.a linux commands reference
3.1.a linux commands referenceAcácio Oliveira
 
OpenGurukul : Operating System : Linux
OpenGurukul : Operating System : LinuxOpenGurukul : Operating System : Linux
OpenGurukul : Operating System : LinuxOpen Gurukul
 
bash_1_2021-command line introduction.pdf
bash_1_2021-command line introduction.pdfbash_1_2021-command line introduction.pdf
bash_1_2021-command line introduction.pdfMuhammadAbdullah311866
 
Basic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manualBasic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manualKuntal Bhowmick
 

Similar to 101 3.3 perform basic file management (20)

101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
 
3.3 perform basic file management
3.3 perform basic file management3.3 perform basic file management
3.3 perform basic file management
 
Unix Basics Commands
Unix Basics CommandsUnix Basics Commands
Unix Basics Commands
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
 
The Linux Command Cheat Sheet
The Linux Command Cheat SheetThe Linux Command Cheat Sheet
The Linux Command Cheat Sheet
 
Basic shell commands by Jeremy Sanders
Basic shell commands by Jeremy SandersBasic shell commands by Jeremy Sanders
Basic shell commands by Jeremy Sanders
 
14.Linux Command
14.Linux Command14.Linux Command
14.Linux Command
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentals
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
3.1.a linux commands reference
3.1.a linux commands reference3.1.a linux commands reference
3.1.a linux commands reference
 
OpenGurukul : Operating System : Linux
OpenGurukul : Operating System : LinuxOpenGurukul : Operating System : Linux
OpenGurukul : Operating System : Linux
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
bash_1_2021-command line introduction.pdf
bash_1_2021-command line introduction.pdfbash_1_2021-command line introduction.pdf
bash_1_2021-command line introduction.pdf
 
Examples -partII
Examples -partIIExamples -partII
Examples -partII
 
Basic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manualBasic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manual
 
Basics of Linux
Basics of LinuxBasics of Linux
Basics of Linux
 

More from Acácio Oliveira

Security+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptx
Security+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptxSecurity+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptx
Security+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptx
Security+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptxSecurity+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptx
Security+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 21 - Types of Application Attacks.pptx
Security+ Lesson 01 Topic 21 - Types of Application Attacks.pptxSecurity+ Lesson 01 Topic 21 - Types of Application Attacks.pptx
Security+ Lesson 01 Topic 21 - Types of Application Attacks.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptx
Security+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptxSecurity+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptx
Security+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptx
Security+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptxSecurity+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptx
Security+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptx
Security+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptxSecurity+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptx
Security+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptx
Security+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptxSecurity+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptx
Security+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 15 - Risk Management Best Practices.pptx
Security+ Lesson 01 Topic 15 - Risk Management Best Practices.pptxSecurity+ Lesson 01 Topic 15 - Risk Management Best Practices.pptx
Security+ Lesson 01 Topic 15 - Risk Management Best Practices.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptx
Security+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptxSecurity+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptx
Security+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptx
Security+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptxSecurity+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptx
Security+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 06 - Wireless Security Considerations.pptx
Security+ Lesson 01 Topic 06 - Wireless Security Considerations.pptxSecurity+ Lesson 01 Topic 06 - Wireless Security Considerations.pptx
Security+ Lesson 01 Topic 06 - Wireless Security Considerations.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....
Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....
Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....Acácio Oliveira
 
Security+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptx
Security+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptxSecurity+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptx
Security+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 01 - Intro to Network Devices.pptx
Security+ Lesson 01 Topic 01 - Intro to Network Devices.pptxSecurity+ Lesson 01 Topic 01 - Intro to Network Devices.pptx
Security+ Lesson 01 Topic 01 - Intro to Network Devices.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...
Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...
Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...Acácio Oliveira
 
Security+ Lesson 01 Topic 07 - Risk Related Concepts.pptx
Security+ Lesson 01 Topic 07 - Risk Related Concepts.pptxSecurity+ Lesson 01 Topic 07 - Risk Related Concepts.pptx
Security+ Lesson 01 Topic 07 - Risk Related Concepts.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 05 - Common Network Protocols.pptx
Security+ Lesson 01 Topic 05 - Common Network Protocols.pptxSecurity+ Lesson 01 Topic 05 - Common Network Protocols.pptx
Security+ Lesson 01 Topic 05 - Common Network Protocols.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 11 - Incident Response Concepts.pptx
Security+ Lesson 01 Topic 11 - Incident Response Concepts.pptxSecurity+ Lesson 01 Topic 11 - Incident Response Concepts.pptx
Security+ Lesson 01 Topic 11 - Incident Response Concepts.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptx
Security+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptxSecurity+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptx
Security+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptxAcácio Oliveira
 
Security+ Lesson 01 Topic 17 - Types of Malware.pptx
Security+ Lesson 01 Topic 17 - Types of Malware.pptxSecurity+ Lesson 01 Topic 17 - Types of Malware.pptx
Security+ Lesson 01 Topic 17 - Types of Malware.pptxAcácio Oliveira
 

More from Acácio Oliveira (20)

Security+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptx
Security+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptxSecurity+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptx
Security+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptx
 
Security+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptx
Security+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptxSecurity+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptx
Security+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptx
 
Security+ Lesson 01 Topic 21 - Types of Application Attacks.pptx
Security+ Lesson 01 Topic 21 - Types of Application Attacks.pptxSecurity+ Lesson 01 Topic 21 - Types of Application Attacks.pptx
Security+ Lesson 01 Topic 21 - Types of Application Attacks.pptx
 
Security+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptx
Security+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptxSecurity+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptx
Security+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptx
 
Security+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptx
Security+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptxSecurity+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptx
Security+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptx
 
Security+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptx
Security+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptxSecurity+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptx
Security+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptx
 
Security+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptx
Security+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptxSecurity+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptx
Security+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptx
 
Security+ Lesson 01 Topic 15 - Risk Management Best Practices.pptx
Security+ Lesson 01 Topic 15 - Risk Management Best Practices.pptxSecurity+ Lesson 01 Topic 15 - Risk Management Best Practices.pptx
Security+ Lesson 01 Topic 15 - Risk Management Best Practices.pptx
 
Security+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptx
Security+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptxSecurity+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptx
Security+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptx
 
Security+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptx
Security+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptxSecurity+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptx
Security+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptx
 
Security+ Lesson 01 Topic 06 - Wireless Security Considerations.pptx
Security+ Lesson 01 Topic 06 - Wireless Security Considerations.pptxSecurity+ Lesson 01 Topic 06 - Wireless Security Considerations.pptx
Security+ Lesson 01 Topic 06 - Wireless Security Considerations.pptx
 
Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....
Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....
Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....
 
Security+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptx
Security+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptxSecurity+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptx
Security+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptx
 
Security+ Lesson 01 Topic 01 - Intro to Network Devices.pptx
Security+ Lesson 01 Topic 01 - Intro to Network Devices.pptxSecurity+ Lesson 01 Topic 01 - Intro to Network Devices.pptx
Security+ Lesson 01 Topic 01 - Intro to Network Devices.pptx
 
Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...
Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...
Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...
 
Security+ Lesson 01 Topic 07 - Risk Related Concepts.pptx
Security+ Lesson 01 Topic 07 - Risk Related Concepts.pptxSecurity+ Lesson 01 Topic 07 - Risk Related Concepts.pptx
Security+ Lesson 01 Topic 07 - Risk Related Concepts.pptx
 
Security+ Lesson 01 Topic 05 - Common Network Protocols.pptx
Security+ Lesson 01 Topic 05 - Common Network Protocols.pptxSecurity+ Lesson 01 Topic 05 - Common Network Protocols.pptx
Security+ Lesson 01 Topic 05 - Common Network Protocols.pptx
 
Security+ Lesson 01 Topic 11 - Incident Response Concepts.pptx
Security+ Lesson 01 Topic 11 - Incident Response Concepts.pptxSecurity+ Lesson 01 Topic 11 - Incident Response Concepts.pptx
Security+ Lesson 01 Topic 11 - Incident Response Concepts.pptx
 
Security+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptx
Security+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptxSecurity+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptx
Security+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptx
 
Security+ Lesson 01 Topic 17 - Types of Malware.pptx
Security+ Lesson 01 Topic 17 - Types of Malware.pptxSecurity+ Lesson 01 Topic 17 - Types of Malware.pptx
Security+ Lesson 01 Topic 17 - Types of Malware.pptx
 

Recently uploaded

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

101 3.3 perform basic file management

  • 1. Junior Level Linux Certification
  • 2. Exam Objectives Key Knowledge Areas Copy, move and remove files and directories individually. Copy multiple files and directories recursively. Remove files and directories recursively. Use simple and advanced wildcard specifications in commands. Using find to locate and act on files based on type, size, or time. Usage of tar, cpio and dd. Objective 3: GNU and Unix Commands Perform basic file management Weight: 4 Terms and Utilities Cp find mkdir mv ls rm rmdir touch tar cpio dd file gzip gunzip bzip2 file globbing 2
  • 3. Process text streams using filters Rundown of commands commands Overview 3 cp - copy files find - find files based on command line specifications mkdir - make a directory mv - move or rename files and directories ls - list files rm - remove files (and directories, if you ask nicely) rmdir - remove directory touch - touch a file to update its timestamp file globbing - *, ?, [abc] and {abc,def} wildcards
  • 4. basic file management ls - lists the contents of directories Files, directories and ls 4 In output of ls, the meaning of columns left to right are: •file type and permissions (d – directory, l – symbolic link, r – read, w – write, x –executable or searchable) •number of links to the file •user name •group name •size (in bytes) •date •time •file name After file name may print additional info. “/” – it's a directory, “*”– it's executable, “>somewhere” it‘s symbolic link bar@foo:~> cd /etc/ppp/ bar@foo:/etc/ppp> ls -la total 68 drwxr-x--- 5 root dialout 4096 2003-05-12 12:36 ./ drwxr-xr-x 53 root root 8192 2003-06-04 10:51 ../ lrwxrwxrwx 1 root root 5 2003-03-03 11:09 ip-down -> ipup* drwxr-xr-x 2 root root 4096 2002-09-10 19:40 ip-down.d/ -rwxr-xr-x 1 root root 9038 2002-09-10 19:40 ip-up* drwxr-xr-x 2 root root 4096 2002-09-10 19:40 ip-up.d/ -rw-r--r-- 1 root root 8121 2002-09-09 22:32 options -rw------- 1 root root 1219 2002-09-09 22:32 pap-secrets #type+perm link user group size date time name Ex:
  • 5. basic file management special characters and strings that can take the place of any characters, or specific characters. File globbing (wildcards) 5 foo:/etc $ ls -l host* -rw-r--r-- 1 root root 17 Jul 23 2000 host.conf -rw-rw-r-- 2 root root 291 Mar 31 15:03 hosts -rw-r--r-- 1 root root 201 Feb 13 21:05 hosts.allow -rw-rw-r-- 1 root root 196 Dec 9 15:06 hosts.bak -rw-r--r-- 1 root root 357 Jan 23 19:39 hosts.deny foo:/etc $ ls [A-Z]* -lad drwxr-xr-x 3 root root 4096 Oct 14 11:07 CORBA -rw-r--r-- 1 root root 2434 Sep 2 2002 DIR_COLORS -rw-r--r-- 1 root root 2434 Sep 2 2002 DIR_COLORS.xterm -rw-r--r-- 1 root root 92336 Jun 23 2002 Muttrc drwxr-xr-x 18 root root 4096 Feb 24 19:54 X11 Ex: shell expands the following special characters just in case they are part of a file name. Filename expansion is only performed if the special characters are in quote ~ /home/user or /root (the user's home directory) echo ~/.bashrc * Any sequence of characters (or no characters) echo /etc/*ost* ? Any one character echo /etc/hos? [abc] Any of a, b, or c echo /etc/host[s.] {abc,def,ghi} Any of abc, def or ghi echo /etc/hosts.{allow,deny}
  • 6. basic file management mkdir – make directory Directories and files 6 [jack@foo tmp]$ mkdir dir1 [jack@foo tmp]$ mkdir dir2 dir3 [jack@foo tmp]$ ls -la total 20 drwxrwxr-x 5 jack jack 4096 Apr 8 10:00 . drwxr-xr-x 12 jack users 4096 Apr 8 10:00 .. drwxrwxr-x 2 jack jack 4096 Apr 8 10:00 dir1 drwxrwxr-x 2 jack jack 4096 Apr 8 10:00 dir2 drwxrwxr-x 2 jack jack 4096 Apr 8 10:00 dir3 [jack@foo tmp]$ mkdir parent/sub/something mkdir: cannot create directory `parent/sub/something': No such file or directory [jack@foo tmp]$ mkdir -p parent/sub/something [jack@foo tmp]$ find . ./dir1 ./dir2 ./dir3 ./parent ./parent/sub ./parent/sub/something Ex: To make directory, use mkdir. By default, parent directory must exist, but with the -p switch mkdir will also create the required parent directories.
  • 7. basic file management Permissions for a new directory are determined by the umask value, unless you set them manually using the -m switch. Directories and files 7 umask Directory mode Directory mode 000 0777 drwxrwxrwx 002 0775 drwxrwxr-x 022 0755 drwxr-xr-x 027 0750 drwxr-x---
  • 8. basic file management rmdir – remove directory Directories and files 8 [jack@foo tmp]$ rmdir dir1 [jack@foo tmp]$ rmdir dir2 dir3 [jack@foo tmp]$ rmdir parent rmdir: `parent': Directory not empty [jack@foo tmp]$ rmdir parent/sub/something/ [jack@foo tmp]$ rmdir parent rmdir: `parent': Directory not empty [jack@foo tmp]$ rmdir parent/sub [jack@foo tmp]$ rmdir parent [jack@foo tmp]$ find . [jack@foo tmp]$ rmdir /etc rmdir: `/etc': Permission denied Ex: rmdir can be used to remove empty directories. If directory contains any files and directories, it will fail. (rm -r can remove).
  • 9. basic file management touch – update a file's time stamp Directories and files 9 [jack@foo tmp]$ mkdir dir4 [jack@foo tmp]$ cd dir4 [jack@foo dir4]$ ls -l total 0 [jack@foo dir4]$ touch newfile [jack@foo dir4]$ ls -l total 0 -rw-rw-r-- 1 jack jack 0 Apr 8 10:28 newfile Ex: originally written to update the time stamp of files. However, due to programming error, touch would create an empty file if it did not exist. By the time this error was discovered, people were using touch to create empty files, and this is now an accepted use of touch. [jack@foo dir4]$ touch newfile [jack@foo dir4]$ ls -l total 0 -rw-rw-r-- 1 jack jack 0 Apr 8 10:29 newfile The second time we run touch it updates the file time
  • 10. basic file management Directories and files 10 Ex: [jack@foo dir4]$ touch file-{one,two}-{a,b} [jack@foo dir4]$ ls –l total 0 -rw-rw-r-- 1 jack jack 0 Apr 8 10:33 file-one-a -rw-rw-r-- 1 jack jack 0 Apr 8 10:33 file-one-b -rw-rw-r-- 1 jack jack 0 Apr 8 10:33 file-two-a -rw-rw-r-- 1 jack jack 0 Apr 8 10:33 file-two-b -rw-rw-r-- 1 jack jack 0 Apr 8 10:29 newfile touch can create more than one file at a time
  • 11. basic file management rm – remove files Directories and files 11 [hack@foo dir4]$ cd .. [hack@foo tmp]$ ls dir4/ file-one-a file-one-b file-two-a file-two-b newfile [hack@foo tmp]$ rm dir4/file*a [hack@foo tmp]$ ls dir4/ file-one-b file-two-b newfile Ex: [hack@foo tmp]$ rm -ri dir4 rm: descend into directory `dir4'? y rm: remove regular empty file `dir4/newfile'? y rm: remove regular empty file `dir4/file-one-b'? y rm: remove regular empty file `dir4/file-two-b'? y rm: remove directory `dir4'? y rm -r can be used to remove directories and the files contained in them. rm -i to specify interactive behaviour (confirmation before removal). Ex: rm -rf is used to remove directories and their files without prompting [hack@foo tmp]$ rm -rf dir4 Ex:
  • 12. basic file management cp – copy files Copying and moving 12 [[jack@foo jack]$ ls [jack@foo jack]$ cp /etc/passwd . [jack@foo jack]$ ls passwd copying a file (/etc/passwd) to a directory (.)Ex: cp -v is verbose about the progress of the copying process. [jack@foo jack]$ mkdir copybin [jack@foo jack]$ cp /bin/* ./copybin [jack@foo jack]$ cp -v /bin/* ./copybin `/bin/arch' -> `./copybin/arch' `/bin/ash' -> `./copybin/ash' `/bin/ash.static' -> `./copybin/ash.static' `/bin/aumix-minimal' -> `./copybin/aumix-minimal' `/bin/awk' -> `./copybin/awk' Ex: cp has 2 modes of usage: 1.Copy one or more files to a directory – cp file1 file2 file3 /home/user/directory/ 2.Copy a file and to a new file name – cp file1 file13 If there are more than 2 parameters given to cp, then last parameter is always the destination directory.
  • 13. basic file management mv – move or rename files Copying and moving 13 [jack@foo jack]$ mkdir fred [jack@foo jack]$ mv -v fred joe `fred' -> `joe' [jack@foo jack]$ cp -v /etc/passwd joe/ `/etc/passwd' -> `joe/passwd' [jack@foo jack]$ mv -v joe/passwd . `joe/passwd' -> `./passwd' use -v so that mv is verbose.Ex: mv is the command used for renaming files [jack@foo jack]$ mv -v passwd ichangedthenamehaha `passwd' -> `ichangedthenamehaha' [jack@foo jack]$ cp /etc/services . Ex: mv (like cp) has 2 modes of operation: 1.Move one or more files to a directory – mv file1 file2 file3 /home/user/directory/ 2.Move a file and to a new file name (rename) – mv file1 file13 If there are more than 2 parameters given to mv, then last parameter is always the destination directory.
  • 14. basic file management find – able to find files find 14 [jack@tonto jack]$ find /usr/share/doc/unzip-5.50/ /etc/skel/ /usr/share/doc/unzip-5.50/ /usr/share/doc/unzip-5.50/BUGS /usr/share/doc/unzip-5.50/INSTALL /usr/share/doc/unzip-5.50/LICENSE /usr/share/doc/unzip-5.50/README /etc/skel/ /etc/skel/.kde /etc/skel/.kde/Autostart /etc/skel/.kde/Autostart/Autorun.desktop /etc/skel/.kde/Autostart/.directory /etc/skel/.bash_logout /etc/skel/.bash_profile .. // .. Ex: Conditions to find files: • have names that contain certain text or match a given pattern • are links to specific files • were last used during a given period of time • are within a given range of size • are of a specified type (normal file, directory, symbolic link, etc.) • are owned by a certain user or group or have specified permissions. Simplest way of using is to specify a list of directories for find to search. By default find prints the name of each file it finds.
  • 15. basic file management find is usually used to search based on particular criteria: find 15 Test Meaning Example -name » find based on the file's name find /bin /usr/bin -name 'ch*‘ -iname » case insensitive file name find /etc -iname '*pass*‘ -ctime » find based on the time that the file was find /home -ctime +365 -mtime created, or last modified, or last accessed find /var/log -mtime -l -atime find /tmp -atime +30 -group » find based on the group or user of the file find /tmp -user `whoami` -user -uid find /tmp -uid `id -u` -gid -perm » find based on the file permissions find /usr/bin -perm -4001 (exactly, or +including, or all) find /etc -type f -perm +111 -size » find files of a particular size find / -size +5000k -type » find files, director., pipes, sockets, links find /dev /var -type p
  • 16. basic file management find -exec find 16 foo:~ $ find /bin -perm -4001 -exec ls -lad {} ; -rwsr-xr-x 1 root root 35302 Jun 23 2002 /bin/ping -rwsr-xr-x 1 root root 81996 Aug 30 2002 /bin/mount -rwsr-xr-x 1 root root 40700 Aug 30 2002 /bin/umount -rwsr-xr-x 1 root root 19132 Aug 29 2002 /bin/su Ex: When find finds a file, default action is to print out file's name. •Alternative action that is quite useful is find –exec: •find executes the specified program, passing the file name to it. •find substitutes the name of the command in the place of the special characters {}. •The command must end with “;” which must be quoted so that it is not interpreted by the shell.