hamburger menu
All Coursesall course arrow
adda247
reward-icon
adda247
    arrow
    arrow
    arrow
    In most Unix-based operating systems, which command is used to create an empty file if the file does not already exist?
    Question

    In most Unix-based operating systems, which command is used to create an empty file if the file does not already exist?

    A.

    cp

    B.

    mkdir

    C.

    touch

    D.

    mkfile

    Correct option is C

    The correct answer is: (c) touch

    Explanation:

    • The **touch** command is used in Unix/Linux systems to create an empty file if it does not already exist.
    • If the file exists, touch updates the access and modification timestamps.
    • Syntax: touch filename.txt creates filename.txt if it doesn't already exist.

    Information Booster:

    • touch is frequently used in shell scripting and file automation.
    • It’s part of GNU core utilities and found in nearly all Unix-based OSs.
    • It doesn’t modify file content, only timestamps.
    • Useful for generating placeholder files.
    • Common in Linux distributions like Ubuntu, Fedora, and macOS.
    • Does not show output unless an error occurs.

    Additional Information:

    • cp – Used to copy files and directories, not create new empty files.
    • mkdir – Used to create directories, not files.
    • mkfile – Used in Solaris OS to create a file of specified size, but not widely used in Linux.

    Free Tests

    Free
    Must Attempt

    CBT-1 Full Mock Test 1

    languageIcon English
    • pdpQsnIcon100 Questions
    • pdpsheetsIcon100 Marks
    • timerIcon90 Mins
    languageIcon English
    Free
    Must Attempt

    RRB NTPC Graduate Level PYP (Held on 5 Jun 2025 S1)

    languageIcon English
    • pdpQsnIcon100 Questions
    • pdpsheetsIcon100 Marks
    • timerIcon90 Mins
    languageIcon English
    Free
    Must Attempt

    CBT-1 General Awareness Section Test 1

    languageIcon English
    • pdpQsnIcon40 Questions
    • pdpsheetsIcon30 Marks
    • timerIcon25 Mins
    languageIcon English
    test-prime-package

    Access ‘RRB NTPC’ Mock Tests with

    • 60000+ Mocks and Previous Year Papers
    • Unlimited Re-Attempts
    • Personalised Report Card
    • 500% Refund on Final Selection
    • Largest Community
    students-icon
    353k+ students have already unlocked exclusive benefits with Test Prime!
    Our Plans
    Monthsup-arrow