Presentation is loading. Please wait.

Presentation is loading. Please wait.

Manipulating Files Refresher. The touch Command touch is used to create a new, empty file. If the file already exists, touch updates the time and date.

Similar presentations


Presentation on theme: "Manipulating Files Refresher. The touch Command touch is used to create a new, empty file. If the file already exists, touch updates the time and date."— Presentation transcript:

1 Manipulating Files Refresher

2 The touch Command touch is used to create a new, empty file. If the file already exists, touch updates the time and date stamp, indicating when the file was last accessed. Usage: –touch myfile

3 The mkdir command The mkdir command allows a user to create a directory. The user must have appropriate permissions. Usage: –mkdir myDirectory Use mkdir –p to automatically create any directories that may not exist when creating child directories: –mkdir –p TopDirectory/BottomDirectory

4 The rm Command The rm command deletes files and directories. rm will delete a file or directory rm –i will interactively ask the user whether it is safe to delete rm –r will recursively delete a directory and anything inside it

5 The cp Command Use cp to copy files and directories Syntax –cp source_file destination_file Multiple files may be copied at once –May use wildcards (* or ?) –May specify multiple file names in source

6 cp Examples

7 cp -i cp –i prevents overwriting (or clobbering) files that already exist. Operates similarly to rm -i

8 Copying Directories To copy directories, use cp –r. Copying a Directory to the Same Directory Copying a Directory to Another Directory

9 The mv Command To move a file or directory, or to rename a file or directory, use the mv command. Syntax –mv source_file destination_file

10 mv Examples Renaming a File or Directory Moving a File or Directory to a Different Directory

11 Input/Output Redirection Standard Input, abbreviated stdin, usually refers to the keyboard Standard Output, abbreviated stdout, usually refers to the monitor Standard Error, abbreviated stderr, usually refers to the monitor Commands commonly accept their input from stdin and send their output to stdout. Input and output can be redirected (come from a location other the stdin and sent to a location other than stdout).

12 Input Redirection command < input_file

13 Output Redirection command > output_file > replaces the file if it exists, otherwise creates it command >> output_file >> appends output to end of the file if it exists, otherwise creates it

14 Redirection Summary


Download ppt "Manipulating Files Refresher. The touch Command touch is used to create a new, empty file. If the file already exists, touch updates the time and date."

Similar presentations


Ads by Google