top of page

Linux - Commands Part 4 Remove , Move & Copy

  • Writer: Mukesh Chanderia
    Mukesh Chanderia
  • Feb 13, 2021
  • 1 min read

Remove File & Folder


root@localhost ~]# rm abc

rm: remove regular empty file ‘abc’? Yes


root@localhost ~]# rm Folder1

rm: cannot remove ‘Folder1’: Is a directory


use "-r" to remove directory


root@localhost ~]# rm -r Folder1

rm: remove directory ‘heyRam1’? Yes


To remove forcefully directory use "-f"

root@localhost ~]# rm -rf test/


use argument "v" to print


root@localhost ~]# rm -vr "mukesh monu"

rm: remove directory ‘mukesh monu’? y

removed directory: ‘mukesh monu’


To remove all data of particular folder

root@localhost ~]# rm -vrf /tmp *

removed ‘/tmp/yum.log’

removed ‘/tmp/.X11-unix/X0’

removed directory: ‘/tmp/.X11-unix’

removed directory: ‘/tmp/.XIM-unix’


root@localhost ~]# mkdir India

[root@localhost ~]# ls

India

[root@localhost ~]# rename India Udaipur India

[root@localhost ~]# ls

Udaipur


Create multiple empty files with single command


root@localhost ~]# touch abc{1..9}

[root@localhost ~]# ls

abc1 abc2 abc3 abc4 abc5 abc6 abc7 abc8 abc9


Copy File "file1" to folder Udaipur


[root@localhost ~]# cp file1.txt Udaipur/


Copy folder to folder requires "-r"


[root@localhost ~]# cp -r Folder1 Folder2


If files are already present in folder then it will ask if you want to overide


root@localhost ~]# cp -rvf abc* India/

cp: overwrite ‘India/abc1’? Y


Now to say "Not" to overwrite add argument"n" in commad

root@localhost ~]# cp -rvfn abc* India


Move Data


root@localhost ~]# mv abc1 India/

mv: overwrite ‘India/abc1’? Y



 
 
 

Recent Posts

See All
Wireshark

1. What is Wireshark? Wireshark is a network packet capture tool . It shows every packet of data moving through your network. Think of it...

 
 
 
MultiCast In ACI

Understanding Multicast in Cisco ACI 1. Multicast Traffic Flow in ACI In ACI, multicast traffic is primarily managed within Bridge...

 
 
 
Quality of Service (QoS) in Cisco ACI

Configuring Quality of Service (QoS)  in Cisco ACI (Application Centric Infrastructure)  involves creating and applying QoS policies that...

 
 
 

Comments


Follow me

© 2021 by Mukesh Chanderia
 

Call

T: 8505812333  

  • Twitter
  • LinkedIn
  • Facebook Clean
©Mukesh Chanderia
bottom of page