mkdir, cp, mv, rm, touch - oregon state...
TRANSCRIPT
![Page 1: mkdir, cp, mv, rm, touch - Oregon State Universityweb.engr.oregonstate.edu/~rubinma/Mines_274/Content/Slides/03_file... · – UNIX> touch newBlankFile.txt ... Assignments/3_file_commands.html](https://reader034.vdocument.in/reader034/viewer/2022051719/5a746d2f7f8b9a9c548bc9d6/html5/thumbnails/1.jpg)
mkdir, cp, mv, rm, touch
![Page 2: mkdir, cp, mv, rm, touch - Oregon State Universityweb.engr.oregonstate.edu/~rubinma/Mines_274/Content/Slides/03_file... · – UNIX> touch newBlankFile.txt ... Assignments/3_file_commands.html](https://reader034.vdocument.in/reader034/viewer/2022051719/5a746d2f7f8b9a9c548bc9d6/html5/thumbnails/2.jpg)
‣ Create a single directory – UNIX> mkdir newDirectoryName
‣ Create multiple directories at once – UNIX> mkdir dir1 dir2 dir3
‣ Create directory within an existing directory – UNIX> mkdir dir1/dir1a
![Page 3: mkdir, cp, mv, rm, touch - Oregon State Universityweb.engr.oregonstate.edu/~rubinma/Mines_274/Content/Slides/03_file... · – UNIX> touch newBlankFile.txt ... Assignments/3_file_commands.html](https://reader034.vdocument.in/reader034/viewer/2022051719/5a746d2f7f8b9a9c548bc9d6/html5/thumbnails/3.jpg)
‣ Syntax: – UNIX> cp source destination
‣ Use –r option for directories – UNIX> cp –r dir1 dir1_copy
‣ Be careful! – There is NO UNDO
– You can easily overwrite files
– UNIX> cp not_so_important.txt crucial.txt
![Page 4: mkdir, cp, mv, rm, touch - Oregon State Universityweb.engr.oregonstate.edu/~rubinma/Mines_274/Content/Slides/03_file... · – UNIX> touch newBlankFile.txt ... Assignments/3_file_commands.html](https://reader034.vdocument.in/reader034/viewer/2022051719/5a746d2f7f8b9a9c548bc9d6/html5/thumbnails/4.jpg)
‣ Syntax: – UNIX> mv source destination
‣ Examples: – Move file1.txt to the above directory: ‧ UNIX> mv file1.txt ../
– Rename file1.txt to new_name.txt ‧ UNIX> mv file.txt new_name.txt
![Page 5: mkdir, cp, mv, rm, touch - Oregon State Universityweb.engr.oregonstate.edu/~rubinma/Mines_274/Content/Slides/03_file... · – UNIX> touch newBlankFile.txt ... Assignments/3_file_commands.html](https://reader034.vdocument.in/reader034/viewer/2022051719/5a746d2f7f8b9a9c548bc9d6/html5/thumbnails/5.jpg)
‣ Delete single file: – UNIX> rm file
‣ Delete multiple files at once: – UNIX> rm file1 file2 file3
‣ Delete a directory (recursive) – UNIX> rm –r dir1
‣ ***BE VERY CAREFUL WITH rm –r*** – NO UNDO!!!
– Why is rm –r / the most evil command ever?
![Page 6: mkdir, cp, mv, rm, touch - Oregon State Universityweb.engr.oregonstate.edu/~rubinma/Mines_274/Content/Slides/03_file... · – UNIX> touch newBlankFile.txt ... Assignments/3_file_commands.html](https://reader034.vdocument.in/reader034/viewer/2022051719/5a746d2f7f8b9a9c548bc9d6/html5/thumbnails/6.jpg)
‣ Syntax: – UNIX> touch fileName [file2] [file3] […]
‣ Create a new blank file – UNIX> touch newBlankFile.txt
‣ Update the file’s timestamp – UNIX> touch newBlankFile.txt
‣ Update several files at once: – UNIX> touch file1.txt newBlankFile.txt file2.txt
![Page 7: mkdir, cp, mv, rm, touch - Oregon State Universityweb.engr.oregonstate.edu/~rubinma/Mines_274/Content/Slides/03_file... · – UNIX> touch newBlankFile.txt ... Assignments/3_file_commands.html](https://reader034.vdocument.in/reader034/viewer/2022051719/5a746d2f7f8b9a9c548bc9d6/html5/thumbnails/7.jpg)
‣ With great power comes great responsibility…
h#p://www.youtube.com/watch?v=D4fzInlyYQo
![Page 8: mkdir, cp, mv, rm, touch - Oregon State Universityweb.engr.oregonstate.edu/~rubinma/Mines_274/Content/Slides/03_file... · – UNIX> touch newBlankFile.txt ... Assignments/3_file_commands.html](https://reader034.vdocument.in/reader034/viewer/2022051719/5a746d2f7f8b9a9c548bc9d6/html5/thumbnails/8.jpg)
‣ http://eecs.mines.edu/Courses/csci274/Assignments/3_file_commands.html