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.
Instructions
Q&A (0)
Notes (0)
Resources (0)
Saving Progress...
Resources
There are no resources for this lesson.
Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.
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.
Creating Files
touch
(Create Empty File)
The touch
command is used to create empty files. If the file already exists, it updates the file's modification timestamp.
touch filename.txt
mv
(Move/Rename Files)
The 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)
The 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)
The rm
command is used to remove files and directories. Be cautious when using it, as deleted files are not recoverable by default.
rm file.txt
echo
(Write to File)
The 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
we covered:
- 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.