mv(1) General Commands Manual mv(1)Name
mv - move or rename files
mv [-i] [-f] [-] file1 file2
mv [-i] [-f] [-] file... directory
The command moves (changes the name of) file1 to file2.
If file2 already exists, it is removed before file1 is moved. If file2 has a mode which forbids writing, prints the mode and reads the
standard input to obtain a line. If the line begins with y, the move takes place. If it does not, exits. For further information, see
In the second form, one or more files (plain files or directories) are moved to the directory with their original file-names.
The command refuses to move a file onto itself.
- Interprets all following arguments as file names to allow file names starting with a minus.
-f Force. This option overrides any mode restrictions or the -i switch.
-i Interactive mode. If a move is to supersede an existing file, the system prompts youw with the name of the file fol-
lowed by a question mark. If you type a string that begins with y, the move occurs. If you type any other response,
the move does not occur.
If file1 and file2 lie on different file systems, must copy the file and delete the original. In this case the owner name becomes that of
the copying process and any linking relationship with other files is lost.
See Alsocp(1), ln(1)mv(1)
Check Out this Related Man Page
diff3(1) General Commands Manual diff3(1)Name
diff3 - 3-way differential file comparison
diff3 [-ex3] file1 file2 file3
The command compares three versions of a file, and publishes the ranges of text that disagree, flagged with the following codes:
==== all three files differ
====1 file1 is different
====2 file2 is different
====3 file3 is different
The type of change needed to convert a given range of a given file to some other is indicated in one of these ways:
f : n1 a Text is to be appended after line number n1 in file f, where f = 1, 2, or 3.
f : n1 , n2 c
Text is to be changed in the range line n1 to line n2. If n1 = n2, the range may be abbreviated to n1.
The original contents of the range follows immediately after a c indication. When the contents of two files are identical, the contents of
the lower-numbered file is suppressed.
Options-3 Produces an editor script containing the changes between file1 and file2 that are to be incorporated into file3.
-e Produces an editor script containing the changes between file2 and file3 that are to be incorporated into file1.
-x Produces an editor script containing the changes among all three files.
Under the -e option, publishes a script for the editor that incorporates into file1 all changes between file2 and file3 - that is, the
changes that would normally be flagged ==== and ====3. Option -x (-3) produces a script to incorporate only changes flagged ==== (====3).
The following command applies the resulting script to `file1':
(cat script; echo '1,$p') | ed - file1
Text lines that consist of a single `.' defeat -e.
See Alsocmp(1), comm(1), diff(1), dffmk(1), join(1), sccsdiff(1), uniq(1)diff3(1)
I've been searching around here and other places, but can't put this together...
I've got a unique list of words in file 1 (one word on each line).
I need to delete each line in file2 that begins with the word in file1.
I started this way, but want to know how to use file1 words instead... (13 Replies)
Hi I'm new to Linux, and I'm trying to write a shell script where I remove a specific file (i.e file1 or file1.txt), but i don't actually remove it, i move it to a directory called 'trash' - in vi I created a file with the path /usr/bin/del and in it I have:
mv $file /home/trash, but I'm getting... (24 Replies)
m here with a small issue. Have read out all the relavent threads on unix.com but it was not so good sol. for me.
It's a simple & known issue. I want to move lots of files to dest folder. Actually I want to pick up 1 year older files, but that is even taking lots of... (16 Replies)
I'm trying to use the find command to return matches for a directory and file.
For example, given the following directories:
I'm expecting the following to be returned:
... (16 Replies)
I have a small problem of renaming multiple files. For example I have names of a set of files in one directory like
and the other set corresponding to the same is
Now... (23 Replies)
I have 2 files with a common column.
File 1 looks like
NAME START POS1 POS2
N1 1234 1236 1237
N2 1245 1248 1250
File 2 looks like
... (25 Replies)
I'm looking to find/create a script so that when a download is complete, I can run the script in order for it to automatically move a file such as...
'example.avi' into my videos folder
I'm a novice when it comes to scripting, any advice/help would be greatly appreciated!
Andrew (10 Replies)
I am trying to to move files from a directory to another which falls from Current day - 7 days. The files are in zipped format with dates appended on it.
Can you pls help me as this came as a immediate change before the production Release planned next week.
Pls let me know if... (11 Replies)
I am coding for a requirement where I need to move files (filename.yymmdd) from one directory(A) to another(B) based on 2 date fields in a paramtere file. (Paramfile.txt)
For e.g: In Paramfile.txt,
In this case, i need to move all the files... (14 Replies)
I am getting crazy after days on looking at it:
Bash in Ubuntu 12.04.1
I want to do this:
pattern="system /path1/file1 file1"
new_pattern=" data /path2/file2 file2"
file to edit: data.db
- I need to search in the file data.db for the nth occurrence of pattern
- pattern must... (14 Replies)
HI I have a list of files that are incorrectely names and I need to move them to new name .. I tried few things that has not worked so far can you help ?
I need to rename all thes eifle ( tere are over 100 )
xldn0439bap.orig.new... (12 Replies)
I`m a total newbie, well my requirement is that i have 2 files
I want to identify which countries i do not currently have in db..
how can i use the grep or another command to find this file ..
i want to match all-countries.txt with countries-in-db.txt so the output is equal to... (11 Replies)
Hi guys, I am using Centos 6.3. Actually I posted similar question but I still have some minor problem need be fixed. I have two files,
file1:target: gi|57529786|ref|NM_001006513.1| mfe: -31.4 kcal/mol p-value: 0.006985
target: gi|403048743|ref|NM_001271159.1| mfe: -29.6 kcal/mol p-value:... (11 Replies)
My original files are like this below and I distinguish them from the AP_ID (file1 has 572 and file2 has 544). Also, the header on file1 has “G_” pre-pended. NOTE: these are only snippets of very large files and much of the data is not present here.
Original File 1:
... (36 Replies)