mv command in linux. Moving and Renaming files.
Colleagues hello to all.
In today's article, we will talk about such a command in Linux as mv. Using the mv command, you can move and rename files and directories in Linux, in general, the tasks that we face every day.
Article content:
- mv command syntax
- Examples.
- Summary
1. Syntax of the mv command.
mv [options] source file where
source file - is what we will be moving or renaming.
where - is the name of the directory where we will move the source file or directory.
2. Examples.
2.1. Rename a file in the current directory.
$. mv demo-small-20170815.sql postgresql.sql
In this example, we simply renamed the demo-small-20170815.sql file to postgresql.sql
2.2. Move the file to another directory.
$. mv postgresql.sql /tmp
In this example, we have moved the postgresql.sql file to the /tmp
directory
2.3. We move the file to another directory with the renaming of the file itself.
$. mv postgresql.sql /tmp/postgres.sql
In this example, we not only moved the postgresql.sql file to the /tmp directory, but also renamed it from postgresql.sql to postgres.sql
3. Results.
And so today we met our colleagues from the cool command for moving and renaming files. You can write a lot more examples, but I give you 100% that you will not use them. And I showed you the commands that you will use almost every day.
Thank you all, I hope that my article helped you in some way.