Multiple choice technology operating systems

You are executing the following commands in a shell $ cp ~/myfile.dat /media/mounted/ext/drive1/newmyfile.dat $ cd /media/mounted/ext/drive1 $ mv newmyfile.dat oldmyfile.dat and now you are asked to display the long listing of the file "newmyfile.dat". Which of the following will you use ?

  1. ls -lrt !cp:2

  2. ls -lrt !mv:1

  3. ls -lrt /media/mounted/ext/drive1/newmyfile.dat

  4. a and b will give "Command not found error" and c will work fine and all other options are incorrect.

  5. a,b and c will give correct results.

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

The commands execute successfully: cp copies ~/myfile.dat to /media/mounted/ext/drive1/newmyfile.dat, cd changes to that directory, mv renames newmyfile.dat to oldmyfile.dat. When asked to display the long listing of 'newmyfile.dat', all three approaches have issues: !cp:2 and !mv:1 are invalid history expansion syntaxes, and the full path references a filename that no longer exists (it was renamed to oldmyfile.dat). Only option E correctly identifies that options A, B, and C will all fail.