Which of the following commands is used to remove files with confirmation prompt from the user file system which have neither been accessed nor modified i the last one year? A. find -mtime +365 | rm B. grep (/usr/*) – mtime + 365 | -ok rm C. find -name – mtime + 365 / – ok rm D. find /user/* (-mtime + 365 – a – atime +365 ) – OK rm {} ; E. None of the above

[amp_mcq option1=”find -mtime +365 | rm” option2=”grep (/usr/*) – mtime + 365 | -ok rm” option3=”find -name – mtime + 365 / – ok rm” option4=”find /user/* (-mtime + 365 – a – atime +365 ) – OK rm {} ; E. None of the above” correct=”option4″]

The correct answer is: D. find /user/* (-mtime + 365 – a – atime +365 ) – OK rm {} ;

The find command is used to find files that match certain criteria. The -mtime option specifies the number of days since the file was last modified. The -a option specifies that the file must also have been accessed in the last year. The -atime option specifies the number of days since the file was last accessed. The -ok option specifies that the command should be run only if the user confirms. The rm command is used to remove files.

The command find /user/* (-mtime + 365 – a – atime +365 ) – OK rm {} ; will find all files in the user file system that have not been accessed or modified in the last year. It will then prompt the user to confirm whether or not to remove each file.

The other options are incorrect because they do not include the -ok option, which is necessary to prompt the user for confirmation before removing files.

Option A: find -mtime +365 | rm

This command will find all files that have not been modified in the last year and then remove them without prompting the user. This is not what is desired, as it could result in the accidental removal of important files.

Option B: grep (/usr/*) – mtime + 365 | -ok rm

This command will find all files in the /usr directory that have not been modified in the last year and then prompt the user to confirm whether or not to remove each file. However, it will not find files in other directories.

Option C: find -name – mtime + 365 / – ok rm

This command will find all files in the current directory that have not been modified in the last year and then prompt the user to confirm whether or not to remove each file. However, it will not find files in other directories.

Option E: None of the above

This option is incorrect because it does not include any of the commands that are necessary to remove files with confirmation prompt from the user file system which have neither been accessed nor modified in the last one year.

Exit mobile version