Linux chown Command In Hindi : chown Command Examples
Linux traceroute Command : traceroute Command In Linux
Linux adduser Command In Hindi
Linux uname command Example | Linux get OS Info
Web Performance In Hindi : Website Performance Kya Hai?
Laravel MySQL Best Pratice : Laravel Tips And Tricks
Send Email In Node.JS In Hindi | NodeMailer Example
Selection Sort in PHP With Example | How does selection sort work in PHP ?
If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
Linux में use होने वाली rm
command बहुत ही common और basic command है। और अगर आप Linux के बारे में ज्यादा नहीं जानते हैं तब भी आपने कही न कहीं इसका use जरूर किया होगा। rm command का main purpose files और directories को remove करना है। इस command का use करके remove की गयी files और directories को undone नहीं किया जा सकता है। means , deleted files और directories को वापस नहीं लाया जा सकता है।
●●●
इस blog में, आप examples के through Linux में rm command के बारे में सीखेंगे कि कैसे इसका use करके किन किन तरीकों से files और directories को remove किया जाता है।
rm filepath
Linux में rm
command का use करके किसी file को remove करना बहुत ही simple है , just rm के बाद file का name pass करने से वो file remove हो जाती है।
For example -
rm file.txt
current directory के लिए आप direct file name pass कर सकते हैं , और अगर file किसी और directory में है तो उसका full path देना पड़ेगा।
rm dir-name/file.txt
आप एक साथ कई files का name भी pass कर सकते हैं -
rm file1 file2 file3
ऊपर दिए गए examples मे rm command के default syntax को follow किया गया था। हालाँकि rm
command कुछ options भी हैं जिन्हे आप rm --help
command run करके देख सकते हैं।
$ rm --help Usage: rm [OPTION]... [FILE]... Remove (unlink) the FILE(s). -f, --force ignore nonexistent files and arguments, never prompt -i prompt before every removal -I prompt once before removing more than three files, or when removing recursively; less intrusive than -i, while still giving protection against most mistakes --interactive[=WHEN] prompt according to WHEN: never, once (-I), or always (-i); without WHEN, prompt always --one-file-system when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument --no-preserve-root do not treat '/' specially --preserve-root[=all] do not remove '/' (default); with 'all', reject any command line argument on a separate device from its parent -r, -R, --recursive remove directories and their contents recursively -d, --dir remove empty directories and some other info ...
अगर आप किसी write-protected files को remove करोगे तो rm command file को delete करने से पहले आपसे confirmation लेगा। confirmation process को by pass करने के लिए आप -f
या --force
pass कर सकते हैं।
rm -f file.txt
दूसरा , file remove करने के time पर अगर file नहीं मिली तो आपको error मिलेगी, वही -f
option use करने पर अगर file exist करती है तो delete हो जायगी और अगर नहीं हुई तो कोई error नहीं आएगी।
Example :
$ rm myfile.txt rm: can't remove 'myfile.txt': No such file or directory $ rm -f myfile.txt $
पिछले example में, जाना कि अगर आप write-protected files को remove करने का try करते हैं तो rm command automatically confirmation के लिए कहेगा। लेकिन अगर आप regular files को remove करने का try करते हैं, तो आपसे कोई confirmation नहीं लिया जायेगा।
इसके लिए आपको -i options का use करना होगा। files को गलती से remove होने से बचने के लिए आपको इसका use करना चाहिए।
Example के लिए मैं एक file.txt
file बनाकर उसे -i option के साथ remove करूंगा।
$ touch file.txt $ ls file.txt $ rm -i file.txt rm: remove 'file.txt'? yes $ ls $
confirmation के लिए आप yes / y pass कर सकते हैं , इसके अलावा कुछ pass करेंगे तो वो as a no ही treat होगा।
directories या उनके अंदर के content को recursively remove करने के लिए -r /-R / --recursive
का use किया जाता है।
$ rm -r dir1 $
empty directories को remove करने के लिए -d / --dir
option का use किया जाता है।
$ rm -d empty-dir $
asterisk (*
) का use करके आप किसी directories में present सभी sub - directories / files को एक बार में remove कर सकते हैं।
$ rm -rf ./*
rm command के लिए provide किये गए options को आप एक साथ pass कर सकते हैं। जैसे rm -rf
का use सभी process को by pass करके files / directories को recursively delete करने के लिए किया जाता है।
$ rm -rf
or
$ rm -rd ./*
I Hope, आपको Linux में rm command के बारे में अच्छे से समझ आया होगा। :)
Loading ...
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook