GATE | GATE-IT-2004 | Question 16

Which of the following commands or sequences of commands will rename a file x to file y in a Unix system?

I. mv y, x

II. mv x, y

III. cp y, x (rm x)

IV. cp x, y (rm x)
(A) II and III
(B) II and IV
(C) l and III
(D) II only


Answer: (B)

Explanation: I. mv y, x                        //will move contents of file x to file y



II. mv x, y                      //will move contents of file y to file x

III. cp y, x (rm x)         //will copy  file x to file y (removal of x after the command)

IV. cp x, y (rm x)         //will move contents file y to file x (removal of x after the command)

 

Hence Answer B

Quiz of this Question

My Personal Notes arrow_drop_up