arrow
arrow
arrow
In Linux OS, which command is used to rename a file from oldname.txt to newname.txt ?
Question

In Linux OS, which command is used to rename a file from oldname.txt to newname.txt ?

A.

Create oldname.txt newname.txt

B.

touch oldname.txt newname.txt

C.

cp oldname.txt newname.txt

D.

mv oldname.txt newname.txt

Correct option is D

The correct answer is (D) mv oldname.txt newname.txt

Explanation:
  • The **mv** (move) command is used in Linux to rename files and directories.

  • When used as mv oldname.txt newname.txt, it renames the file without creating a duplicate.

  • This command is efficient because it simply updates the file metadata without copying data.

Information Booster:
  • mv is used for both moving and renaming files or directories.

  • Syntax: mv [source] [destination]

  • Example: mv notes.txt archive/ moves notes.txt into the archive folder.

  • No confirmation prompt is given by default; existing files may be overwritten unless -i (interactive) is used.

Additional Information:
  • Option A – Create: Not a valid Linux command.

  • Option B – touch: Creates new empty files; cannot rename or move files.

  • Option C – cp: Copies the file to a new name but keeps the original file intact.

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
175k+ students have already unlocked exclusive benefits with Test Prime!

Free Tests

Free
Must Attempt

RRB Technician Gr.III Full Mock Test 1

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

RRB Technician Grade-3 PYP (20 Dec 2024 S2)

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

General Science Section Test 01

languageIcon English
  • pdpQsnIcon40 Questions
  • pdpsheetsIcon40 Marks
  • timerIcon20 Mins
languageIcon English