Working with files and directories: create, copy, delete
Sign in to read this lesson
When you run a server, creating files, copying a configuration to a backup, renaming and deleting files are daily work. In this lesson we learn touch, mkdir, cp, mv and rm, the star (*) pattern and searching for files with find.
What you will learn
touch filecreates an empty file,mkdir dircreates a directory;mkdir -p a/b/calso creates the directories in between.cp source targetcopies (cp -rfor directories);mvboth moves and renames.rmdeletes a file for good, with no recycle bin. Userm -rfor directories;-iasks every time.- Patterns:
— any number of characters,?— one character:ls /etc/.conf. find /etc -name "*.conf"searches by name;find /var/log -mtime -1finds files changed in the last day.
The lesson has 5 key points, an explanation and 5 questions. It opens with a package.