mv
mv(move) is used to move a file.
> mv filename1 filename2
mv(move) command moves the file from filename1 to filename2.
If both the files are in the same directory then it renames the file filename1 to filename2.
> mv filename1 filename2 filename3 filename4 dirName
This command will move all the files mentioned to directory dirName
> mv *.dat dirName
This command will move all the files with an extension(.dat) to directory dirName
> mv dirName myDir
This command will move one directory to another ex: dirName to directory myDir
> mv -i filename1 filename2
mv: overwrite 'filename2'? n
This command will prompt you before overwriting the file.
> mv -b filename1 filename2
This command will create a backup of filename2 if existing.
> mv -S .bkp -b filename1 filename2
This command will create a backup of filename2 if existing with a suffix as .bkp.
Name of existing file will be then filename2.bkp.
Also a new file with filename2 will be created.
No comments:
Post a Comment