Title: Basic Directory and File Management
1Chapter 6 Basic Directory and File Management
2Command Line Control Characters
Control-s - Stops screen output - rarely
used Control-q - Resumes screen output stopped
by Control-s - also rare Control-c - Interrupts
current activity - frequently used to abort
processes or long display outputs Control-d -
end-of-file or exit. If stuck, try Control-c or
Control-d Control-u - Erases the entire command
line - mistyped passwords Control-w - Erases the
last word on the command line
3file and strings Commands
Text ASCII or English text, commands text, and
executable shell scripts can be read using the
cat or more commands and edited using vi
editor Data created by an application only way
to read is to open the file with its app Strings
command - prints out readable characters from an
executable or binary file used by
programmers Executable or Binary indicates that
the file is a command or program strings command
will print out readable characters
4cat more head tail Commands
cat (short for concatenate) command displays the
contents of a text file on the screen cat flashes
through the entire file rapidly without
pausing stop start the scrolling with the
Control-s and Control-q keys more command
displays the contents of a text file one screen
at a time --More--(n) man pages output are in
more format -scrolling controls head command
displays the first n lines first 10 lines are
displayed by default if the -n option is
omitted. tail command displays the last n lines
of a file last 10 lines are displayed by default
if the -n option is omitted. allows you to check
the end result of the backup without looking at
the whole file n option allows you to start
displaying lines from a specific point in a file
5wc and diff Commands
wc (word count) command displays line, word, byte
or character counts for a text file without
options will give a line, word, and byte count of
the contents of the file Option Function -l Counts
lines -w Counts words -c Counts bytes -m Counts
characters diff (difference) command compares
two text files and finds differences Command
Format diff option file1 file2 i option
ignores the case of the letters c option
performs a detailed comparison and produces a
listing of differences with three lines of context
6diff Output
7Naming Conventions
8Creating Removing Files Directories
touch - either creates one or more files with
zero bytes if none exists or updates date/time
stamp if file already exists mkdir - creates
directories or folders must have the appropriate
permissions to create a directory p (parent)
option creates parent directories while creating
lower level directories, including all the
directories in a pathname rm - removes a single
file or multiple files specify their names or use
wildcard metacharacters () (?) files that are
deleted are permanent and cannot be recovered! rm
-i (interactive) - prompts the user before
removing files - highly recommended rm r
(recursive) - removes directories removes the
directory including all subdirectories and files
in it! rm -ri (or rm -ir) removes directories
interactively
9CDE File Manager
accessed from the Front Panel or by right
clicking on the desktop most of the same tasks
that are available at the command line benefit -
can undelete can NOT compare files as with diff
command
10Labs/Assessment
Lab 6.1.6 File Information Commands Lab 6.1.10
Basic Command Line File Management Lab 6.2.6
Basic CDE File Manager chapter 6 assessment
11Chap 6 Exercise
1. Create a new file called junk1 then verify
how many bytes?
12Chap 6 Exercise
1. Create a new junk file then verify how many
bytes? touch junk1 ls -l junk1
13Chap 6 Exercise
2. Make directory called junkdir then verify
14Chap 6 Exercise
2. Make a directory called junkdir then verify
mkdir junkdir ls -ld junkdir or ls -l
15Chap 6 Exercise
3. Remove that junk file and that junk directory
16Chap 6 Exercise
3. Remove that junk file and that junk
directory rm -i junk1 rm -ir junkdir
17(No Transcript)