• Skip to main content
  • Skip to primary sidebar
  • Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / Linux sysadmin tutorials linux system administrator / TOP 10 mv & cp commands in linux to move & copy files in Linux

TOP 10 mv & cp commands in linux to move & copy files in Linux

Table of Contents

Toggle
    • MV Command in linux explained
  • cp command(to copy)
    • To copy single file
    • copying directory
  • copying multiple internal directories recursively
    • copy all files from one directory to another linux
  • delete existing files before copying or overwriting existing
    • copying wordpress themes to another wordpress directory in linux
  • CP command to copy wordpress plugin to another website directory
  • copy files with overwrite and recursively Linux
  • errors

MV Command in linux explained

Mv  means move
To rename
To move
mv [Option] source destination
Note: make sure to wait some time if you are moving large& multiple files
Ex: by renaming /var/www/html/var/www/html/all directories
Renaming file in linux
mv file1.txt desired name.txt
If file exist it’s overwrites, if not it will create.
-i asks for confirmation moving file
-f confirmation for overwriting (if write protected)
-b backup original file ~
mv -b file1 filed
ls
Filed file1~
-n existing file not overwrites
ls
file1.txt file2.txt
mv -n file1.txt xfile.txt
ls -l
file1.txt
file2.txt
xfile.txt

cp command(to copy)

To copy single file

cp source target
ls
file1.txt
cp file1.txt file2.php
ls
file1.txt
file2.php

copying directory

cp dir dir2
copy wordpress instalation direcotry to another
cp -r wordpress1 desiredname
or
cp -r /var/www/html/sarkariresultpro.in /var/www/html/sarkariplex.com
also check directory size
du -sh /path/to/directory
root@instance-1:~# du -sh /var/www/html/sarkariresultpro.in
1.2G 

copying multiple internal directories recursively

cp -r /var/www/html /etc/home/usr
cp -r /var/www/html/wordpress.in/wp-content/plugins/*  /var/www/html/wp2.in/wp-content/plugins/

copy all files from one directory to another linux

-b for backup
-s to specify backup file name
-i  overwritten confirmation
-l hardlink instead of creating new file.
–preserve to preserve file attributes &ownership details

delete existing files before copying or overwriting existing

rm -rf /var/www/html/wp.in/wp-content/plugins/*

copying wordpress themes to another wordpress directory in linux

cp -r /var/www/html/wordpress1.in/wp-content/themes/* /var/www/html/woprdpress2.com/wp-content/themes/

CP command to copy wordpress plugin to another website directory

cp -r /var/www/html/wordpress1.in/wp-content/plugins/* /var/www/html/woprdpress2.com/wp-content/plugins/
singe plugin
cp -r /var/www/html/wordpress1.in/wp-content/plugins/pluginname /var/www/html/woprdpress2.com/wp-content/plugins/pluginname
example
cp -r /var/www/html/muralijobs.in/wp-content/plugins/wp-schema-pro /var/www/html/recruitmentsboard.com/wp-content/plugins/wp-schema-pro
check plugins list
/var/www/html/muralijobs.in/wp-content/plugins/
cp -r /var/www/html/muralijobs.in/wp-content/plugins/custcode /var/www/html/railwayvacancy.in/wp-content/plugins/custcode

copy files with overwrite and recursively Linux

cp command to overwrite a copy operation without confirmation in Linux.

errors

cp: cannot stat ‘cp’: No such file or directory
cp: will not overwrite just-created
cp: target ‘/var/www/html/shivajobs.in/wp-content/plugins/*‘ is not a directory

Primary Sidebar

Linux sysadmin tutorials linux system administrator

  • top 10 apt & apt-get commands (most used) apt vs apt-get
  • If-Else Statements in Shell Scripting
  • linux commands pdf (files & Directories, zip & unzip process, search etc)
  • Find Files with Specific Text on Linux grep find command
  • linux performance tuning inode limit file descriptors tco, kernel etc
  • Variables and Data Types in Shell Scripting
  • Top 10 most used Cat commands with examples (create, view, append files)
  • Ip tables / ufw / firewall d commands for block port ip rate limiting
  • Top 10 zip / tar commands to compress & extract files in linux
  • TOP 10 mv & cp commands in linux to move & copy files in Linux
  • Top 10 GREP Commands in linux to search files directory words strings
  • lsof netstat commands to know listening ports in linux 3 ways
  • Upgrade Ubuntu from 18.04 (19.10) to 20.04 LTS command line or gui server | desktop
  • 3 Ways (SCP, rsync, Sftp) linux server migration between two remote server apache nginx
  • linux system specs commands (CPU, Memory, Disk )speed, type. manufacture
  • linux sysctl command tweaks & hardening
  • linux security limits.conf deciding user limits process limits for nginx server
  • ulimit linux unlimited command unlimto set & know user limits open files file descriptor max user process etc.
  • red hat linux certification cost jobs salary syllabus courses fees
  • ufw firewall commads allow port enable disable ubuntu 20.04
  • ddos attack prevention
  • change ssh port in linux - avoid sshd ddos attacks
  • ping command
  • memcached install ubuntu wordpress
  • check linux version (lsb_release -a) ubuntu debian 32 or 64 bit
  • rsync command linux with examples comparison to scp
  • how to uninstall package in linux ubuntu rpm, yum apt-get
  • increase open file limit linux File descriptor ft nginx , mysql, lemp
  • remove repository ubuntu
  • htop commad memory details virtual vs shard vs resident
  • chown command in Linux with Examples
  • Kill PHP process
  • VIrtual Memory vs RSS Memory vs Shared memory in Linux
  • oom killer fixing it by configuration linux ubuntu
  • Install Lemp nginx mysql php fpm Stack on Debian 11 with repository
  • connect two remote servers linux command line
  • auto start after oom killer Mysql & php fpm nginx etc ubuntu wth systemd or cron job
  • load average Linux 1, 5, 15 min 2,4,8 cores explained
  • Control Structures in Shell Scripting
  • Shell Scripting Roadmap for Beginners to Advanced
  • awk commands with practical examples
  • Shell Scripting Tutorial for Beginners 🚀
  • find Command in Linux with Examples
  • sed Command in Linux with Examples (Beginner to Advanced)
  • Linux Text processing commands in with Examples
  • linux disk management commands
  • fdisk command in linux with examples
  • how to add a new disk in linux
  • Linux mount Command with Examples
  • fstab options with examples
  • Top 50 Shell Scripting Interview Questions and Answers
  • Linux Networking Interview Questions and Answers
  • Linux Networking Commands Cheat Sheet with Examples pdf
  • Netstat & SS Commands cheat sheet with examples Interview Questions
  • Nmap Cheat Sheet – Network Scanning & Security
  • Bash Brackets ([], (), {}, $( ), $(( ))) – Types, Uses & Examples

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy