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 [options] source 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 [options] sourcefiles 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

Horizontal Scaling vs Vertical Scaling

 একটা application হঠাৎ করে অনেক বেশি user পেতে শুরু করল। আগে যেখানে ১,০০০ জন user ছিল, এখন সেখানে ১ লাখ user! তখন স্বাভাবিকভাবেই প্রশ্ন আসে—...