Creating and Deleting Files
Full-Access Members Only
Sorry, this lesson is only available to Server Academy Full-Access members. Become a Full-Access member now and get instant access to this and many more premium courses. Click the button below and get instant access now.
There are no resources for this lesson.
In this lesson, you will learn how to manipulate files on a Linux/Unix system. We will cover essential commands for creating, reading, and modifying files.
touch (Create Empty File)
touch command is used to create empty files. If the file already exists, it updates the file's modification timestamp.
mv (Move/Rename Files)
mv command is used to move or rename files and directories. It can be used to change the location or name of a file.
mv oldfile.txt newfile.txt # Renames a file mv file.txt /path/to/directory # Moves a file
cp (Copy Files)
cp command is used to copy files and directories. It creates a duplicate of the source file in the specified location.
cp sourcefile.txt destination/
rm (Remove Files)
rm command is used to remove files and directories. Be cautious when using it, as deleted files are not recoverable by default.
echo (Write to File)
echo command is used to write text to a file. It can be used to create or append text to a file.
echo "test" > test.txt # Create a file with "test" content echo "more text" >> test.txt # Append text to an existing file
- touch: Create or update empty files.
- mv: Move or rename files and directories.
- cp: Copy files and directories.
- rm: Remove files (and directories with -r).
- echo: Write or append text to a file.
See you in the next lesson!
Server Academy Members Only
Sorry, this lesson is only available to Server Academy Full Access members. Become a Full-Access Member now and you’ll get instant access to all of our courses.