cp, mv, rm कमांड्स
cp, mv और rm एक page को photocopy करना, एक page को दूसरे folder में move करना, और एक page को shredder में डालना जैसा है। हर एक files को अलग तरीके से handle करता है।
In this page:
Syntax
cp source destination
mv source destination
rm [-r] file_or_directory
cp, mv, rm
cp files copy करता है, mv उन्हें move या rename करता है, और rm उन्हें delete करता है। cp -r और rm -r directories पर recursively operate करते हैं। यह shell scripts में हर समय उपयोग होने वाले fundamental filesystem manipulation commands हैं।
Warning:
rm -rf confirmation के बिना recursively delete करता है — path में एक typo intended से कहीं ज़्यादा destroy कर सकता है।उदाहरण: cp, mv, rm
#!/bin/bash
echo "original" > original.txt
cp original.txt copy.txt
mv copy.txt renamed.txt
ls original.txt renamed.txt
rm renamed.txt
echo "renamed.txt removed"
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
rm -rfएक empty variable के साथ चलाना, जैसेrm -rf "$dir/", जो गलत path delete कर सकता है।cpयाmvसे files को बिना-iया-nके overwrite करना।- एक directory copy करते समय
-rभूल जाना।
🔒
Chapter Quiz — Complete all 13 topics to unlock
0/13 topics done
Complete these topics first: