mv command in linux. Moving/Renaming files.

mv command in linux. Moving/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:

  1. mv command syntax
  2. Examples.
  3. 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

linux_command

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

linux_command

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

linux_command

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.

SIMILAR ARTICLES

tail command in linux. View the last lines of a file.
tail command in linux. View the last lines of a file.
TERMINAL
Read more
Linux command cal, calendar
Linux command cal, calendar
TERMINAL
Read more
Linux date command: how to set, change, format and display date
Linux date command: how to set, change, format and display date
TERMINAL
Read more