Thursday, February 4, 2021

All mv command in Linux/Unix

 

Linux mv command.

mv command is used to move files and directories.

mv command syntax

$ mv [optionssource dest

mv command options

mv command main options:
optiondescription
mv -fforce move by overwriting destination file without prompt
mv -iinteractive prompt before overwrite
mv -uupdate - move when source is newer than destination
mv -vverbose - print source and destination files
man mvhelp manual

mv command examples

Move main.c def.h files to /home/usr/rapid/ directory:
$ mv main.c def.h /home/usr/rapid/

Move all C files in current directory to subdirectory bak :
$ mv *.c bak

Move all files in subdirectory bak to current directory :
$ mv bak/* .

Rename file main.c to main.bak:
$ mv main.c main.bak

Rename directory bak to bak2:
$ mv bak bak2

Update - move when main.c is newer:
$ mv -u main.c bak
$

Move main.c and prompt before overwrite bak/main.c:
$ mv -v main.c bak
'bak/main.c' -> 'bak/main.c'
$

Unix/Linux move files.

Move file syntax:
$ mv [optionssourcefiles destdir

Move main.c def.h files to /home/usr/rapid/ directory
$ mv main.c def.h /home/usr/rapid/

Move all C files in current directory to subdirectory bak
$ mv *.c bak

No comments:

Post a Comment

To generate a PDF using JavaScript in Oracle APEX from a collection

  To generate a PDF using JavaScript in Oracle APEX from a collection, you can follow these steps: 1. Create a button or link on your APEX p...