1 / 14

CS 497C – Introduction to UNIX Lecture 13: - The File System

CS 497C – Introduction to UNIX Lecture 13: - The File System. Chin-Chih Chang chang@cs.twsu.edu. mv: Moving or Renaming Files. mv renames (moves) files and directories. It has two functions: Rename a file (or directory). Move a group of files to a different directory.

cpetersen
Download Presentation

CS 497C – Introduction to UNIX Lecture 13: - The File System

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. CS 497C – Introduction to UNIXLecture 13: - The File System Chin-Chih Changchang@cs.twsu.edu

  2. mv: Moving or Renaming Files • mv renames (moves) files and directories. • It has two functions: • Rename a file (or directory). • Move a group of files to a different directory. • Like cp, a group of files can be moved to a directory. • mv can also be used to rename a directory. • There is a –i (interactive) option available with mv.

  3. cat: Displaying and Creating Files • The cat command is the universal file viewer. • cat is normally used for displaying text files only. Executables, when seen with cat, simply display junk. • If you have nonprinting ASCII characters in your input, you can use cat with the –v option to display these characters. • You can also cat to create a file.

  4. cat: Displaying and Creating Files • Enter the command cat, follow it with > and the filename foo: $ cat > foo A > symbol following the command means that the output goes to the filename following it. [Ctrl-d] • The [Ctrl-d] is used to end the session of all commands that accept input from keyboard.

  5. file: Know the File Types • The file command tells not only the file types (ordinary, directory, and device) but also more information about these files. $ file semaphore.c semaphore.c C program text $ file *

  6. lp and cancel: Printing a File • A user has to spool (or line up) a job along with others in a print queue. • The spooling facility in System V is provided by the lp (line printing) command. lp chap01 • The –d (destination) option with the printer name identifies which printer is used. • The –t (title) option prints the title on the first page.

  7. lp and cancel: Printing a File • The –m (mail) option is used to notify the user after the file has been printed. • You can print more than one copy by using –n option. lp –dlaser chap01 lp –n3 –m chap01 • Jobs queued by lp are canceled with the cancel command.

  8. Printing with lpr, lpq, and lprm • Linux uses Berkeley’s printing system which supports the lpr command for printing and lprm for removing jobs. • To know the number of the job, use the lpq command. $ lpr typescript $ lpq $ lprm 17

  9. df: Finding Out the Free Disk Space • The df command finds out the free disk space. • It shows how many blocks (usually 512 bytes) of disk space and inodes (files) are free for use. • The –t (total) option includes the total amount of disk space in each file system.

  10. du: Finding Out Your Own Consumption • The du (disk usage) command reports disk usage by a recursive examination of the directory tree. du . • The –s (summary) summarizes the disk usage.

  11. Compress, gzip, and zip: Compress Your Files • For disk space conservation or the fast download, files are frequently compressed. • The most frequently used compression programs in UNIX are compress, gzip, and zip. • The compress command produces the file with Z extension.

  12. Compress, gzip, and zip: Compress Your Files compress daily.log uncompress daily.log.Z • You can use the zcat command to uncompress a file and see its contents. A compressed gzip file has the extension .gz. • It is decompressed with the gunzip command. gzip sales.dbf gunzip sales.dbf.gz

  13. Compress, gzip, and zip: Compress Your Files • gzip today is a standard compression utility on the Internet. • Phil Katz’s pkzip program compresses multiple files into an archive (a single file containing a group of files). zip fin *.html • With the –r option, zip can also recursively compress an entire directory. zip –r zipdir docs

  14. Compress, gzip, and zip: Compress Your Files • On the Internet, you’ll see these extensions: • .zip – These are files compressed with zip. • .tar – Files archived into a single file with the UNIX tar command. • .gz – These are compressed with gzip. • .tar.Z – Files archived into a single file with tar and then compressed with compress. • .tar.gz – Files archived into a single file with tar and then compressed with gzip.

More Related