File handling using the mv command (moving and renaming)
The mv or move command is used when we wish to move files from one directory to another, and we don't want to create duplicates while doing this (something that happens when using the cp
command).
Getting ready…
Since mv
is a built-in command of Linux, we don't have to configure anything else to understand how it works.
How it works…
On every Linux system, this command is installed by default. Let's take a look at how to use the mv
command by taking different kinds of examples:
- To move the
testfile1.txt
file from the current directory to any other directory, such ashome/practical
/example
, the command is as follows:mv testfile1.txt /home/practical/example
The preceding command will work only ...
Get Practical Linux Security Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.