1 / 17

Chapter 6 Basic Directory and File Management

Chapter 6 Basic Directory and File Management. Command Line Control Characters. Control-s - Stops screen output - rarely used Control-q - Resumes screen output stopped by Control-s - also rare

emlyn
Download Presentation

Chapter 6 Basic Directory and File Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 6 Basic Directory and File Management

  2. Command 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

  3. file 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

  4. cat 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 -noption 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

  5. wc 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 OptionFunction -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

  6. diff Output

  7. Naming Conventions

  8. Creating & 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

  9. CDE 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

  10. Labs/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

  11. Chap 6 Exercise 1. Create a new file called junk1; then verify; how many bytes?

  12. Chap 6 Exercise 1. Create a new junk file; then verify; how many bytes? $ touch junk1 $ ls -l junk1

  13. Chap 6 Exercise 2. Make directory called junkdir; then verify

  14. Chap 6 Exercise 2. Make a directory called junkdir; then verify $ mkdir junkdir $ ls -ld junkdir or $ ls -l

  15. Chap 6 Exercise 3. Remove that junk file and that junk directory

  16. Chap 6 Exercise 3. Remove that junk file and that junk directory $ rm -i junk1 $ rm -ir junkdir

More Related