SSC IMD SA 2017 – Question 191

Question:

Which command is used to remove a directory?

निर्देशिका को हटाने के लिए कौन से कमांड का उपयोग किया जाता है?

Options:

  • rd
  • rmdir
  • dldir
  • rdir
  • rd
  • rmdir
  • dldir
  • rdir

Correct Answer: b)

Explanation:

Detailed Explanation:

The correct answer is b) rmdir.

In command-line environments across UNIX, Linux, POSIX-compliant operating systems, and DOS/Windows Command Prompt:

  • rmdir (Remove Directory): The standard system utility specifically designed to remove/delete empty directories from the filesystem hierarchy.
  • Syntax: rmdir directory_name
  • Key Behavior: By default, rmdir succeeds only if the target directory is empty, which protects users from accidental loss of contained files. In Linux/UNIX, to remove a non-empty directory along with all its subdirectories and files recursively, the command rm -r directory_name is used.
  • Note on Option (a): While rd is an abbreviation used in the Windows Command Prompt (cmd.exe), rmdir is the universal, cross-platform standard utility across both UNIX/Linux and Windows environments.

विस्तृत व्याख्या:

सही उत्तर b) rmdir है।

यूनिक्स (UNIX), लिनक्स (Linux) और डॉस (DOS/Windows) ऑपरेटिंग सिस्टम में:

  • rmdir (Remove Directory): खाली डायरेक्टरी (निर्देशिका) को फ़ाइल सिस्टम से हटाने के लिए प्रयुक्त सबसे मानक और सार्वभौमिक कमांड है।
  • सिंटैक्स: rmdir directory_name
  • महत्वपूर्ण बिंदु: rmdir केवल तभी डायरेक्टरी को हटाता है जब वह खाली हो, जिससे आकस्मिक डेटा हानि से सुरक्षा मिलती है। गैर-खाली (Non-empty) डायरेक्टरी को हटाने के लिए लिनक्स में rm -r का उपयोग किया जाता है।
  • यद्यपि विंडोज में rd भी कार्य करता है, किंतु rmdir यूनिक्स और क्रॉस-प्लेटफॉर्म का मानक कमांड है।

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top