Download presentation
Presentation is loading. Please wait.
1
Chapter 7 Advanced Directory and File Management
2
Copying Files cp (copy) - copies files and directories new file created with a different name in the same directory files copied to a different directory location (local or remote) or disk as with rm command, -i option prompts you to overwrite an existing file can be used with metacharacters (* ?) to copy multiple files at once
3
Copying Directories cp –r (recursive) - copies a directory and all of its contents must use -r option to copy a directory example 1 - new directory created with a different name in the same directory example 2 - directory copied to a different directory location
4
Multipurpose mv Command mv (move) - moves or renames files and directories move a file to a directory if the last argument is a directory; if not, will rename the file (cp command copies a file and gives it a new name leaving the original file intact) -i option prompts you if you are about to overwrite an existing file mv a file within the same directory renames it: $ ls beansnuts $ mv nuts brands $ ls beansbrands mv a file to another directory moves it; and renames it if specified $ mv brands /testdir/newname $ ls /testdir newname
5
Input / Output Redirection Commands right angle bracket (>) output redirection - creates a new file or overwrites existing Two right angle brackets (>>) appends the output to the specified file left angle bracket (<) input redirection right angle bracket preceded by the number two (2>) error redirection file can be a text file or a device file $ CommandRedirection Symbol File (text file or device file)
6
Command Piping One of the most powerful metacharacters is the pipe (|) standard output of one command and passes it as standard input into a following command must always have a command on each side of a pipe redirect takes a command to a file; pipe takes a command to a command for an administrator to see the users in his system, he would type: # cat /etc/password | more
7
CDE File Manager advanced capabilities for manipulating files and folders: moving (select + drag + drop) and copying (control + select + drag + drop) Selected menu: files and folders pre-selected to be copied, moved, renamed or put in Trash change file and directory permissions using properties option View menu can customize file and folder displays, including file system as a tree
8
Lab 7.1.2 - Copying Files and Directories Lab 7.1.4 – Renaming and Moving Files and Directories Lab 7.1.6 - Redirection and Command Piping Lab 7.2.3 Advanced CDE File Manager chapter 7 assessment Labs/Assessment
9
$ mv ??[abc]../.. mv Exercise
10
$ mv ??[abc]../.. move any file with only three characters in the name, anything in the first two character positions, a or b or c in the third position, up two directory levels mv Exercise
11
$ ls -al | head > myfiles Piping & Redirection Exercise
12
$ ls -al | head > myfiles take the top ten files listed and put it in a file called myfiles Piping & Redirection Exercise
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.