SlideServe
Menu
Préférences
© SlideServe · v2026

Working with Files

kerri avatar
21 diapositives · 497 Views · Sep 10, 2014

Working with Files. How to create, view, copy, rename and print files. Create a Calendar. Create a calendar for a specific month cal 12 2000 Create a calendar for a specific year cal 2000. Creating a file with redirection. Most commands send their output to the screen.

Working with Files - slide 1
01 / 21Working with Files
1 / 17

Télécharger la présentation

Working with Files
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Working with Files How to create, view, copy, rename and print files.

  2. Create a Calendar • Create a calendar for a specific month • cal 12 2000 • Create a calendar for a specific year • cal 2000

  3. Creating a file with redirection • Most commands send their output to the screen. • You can change (redirect) where you want the results sent. • cal 2000 > 2001

  4. ls list Displays the names of the files in the current directory. Flags: -a: shows all the files, including hidden ones -F: puts a / after directories, an * after executables, and an @ after links -l: displays a long listing of files -R: will also list contents of sub-directories -s: will list the size of the files

  5. Viewing the file What if you want to see the contents of a file? Use the cat command cat [name of file] cat 2000 Use the more command more [name of file] more 2000

  6. Chaining files together Use the cat command to see more than one file cal 6 2000 > june cal 7 2000 > july cal 8 2000 > august cat june july august Send the results to another file cat june july august > summer2000

  7. Appending files Unix allows you to add information to the end of a file rather than overwriting it. This is called appending and is done with the >> cal 9 2000 >> summer2000

  8. cp copy Copies the contents of one file to another. cp [file to copy] [new file name] Flags -r: will copy directories and all their contents. Without this flag, the directory will not be copied and you will get an error message.

  9. mv move Better name could be the rename command. Changes the name of one file to another. mv [old file name] [new file name] Note, if [new file name] is a directory, you will move [old file name] to that directory and keep the original name.

  10. lpr print command (stands for “line printer”) This prints the file(s) you specify to the printer you specify. lpr [flags] [file name(s) to print] Flags: -P: specifies the name of the printer to print to. -w[1-n]: specifies the number of pages to print per page. -h: removes the header page.

  11. lpq view print queue (stands for “line printer query”) When you print a file, it gets sent to a print queue (a line of files waiting to be printed). lpq will show you the names of the files in the print queue. Use the -P flag just like in lpr to specify the printer whose queue you wish to view.

  12. lprm • line printer remove • Used to remove a file from the print queue. • Use the lpq to see the file and then use lprm [job number] to remove the specific job. • You can only remove print jobs that you sent to the printer. • Use the ‘-’ flag to remove all your files.

  13. rm remove Deletes the specified file or files. This is destructive! They are gone! They cannot be retrieved!!! rm [file name] Note: this does not generally work with directories.

  14. Working with Directories A directory is just a file that contains other files. Now we will learn commands to create directories, move files between directories, rename files and delete directories.

  15. mkdir make directory This creates a directory. mkdir [new directory name] mkdir calendar

  16. Moving files between directories When you create a directory, it contains no files. You need to put files into it with the mv command. mv summer2000 calendar

  17. You can create subdirectories within directories. mkdir calendar/months You can move files into those subdirectories mv june calendar/months You can use other commands in a similar manner ls calendar/months ls / Using pathnames

  18. cd • change directory • Changes the directory to whatever you specify. • cd [name of directory] • Without any directory (just cd) you will be taken to your home directory.

  19. pwd print working directory Displays the full path of the current directory you are in.

  20. rmdir remove directory This deletes a directory (as opposed to the rm command above). The directory must be empty otherwise you will get an error.

  21. Reading Chapters 7 and 8 Access Privileges