Unix - Engineering

Q1:

Which of the following commands is used to update access and modification times of a file?

A grep

B wc

C touch

D cat

E None of the above

ANS:C - touch

There are various options with touch I will be talking about -m (modification time).

Let say you created a file and modified it at 12.

Use the command "stat file_name" it will give details about access, modify and change time it will show the modify time as 12.

Now let say at 12 : 30 you enter the command "touch -m file_name" it will change the modify time to 12 :30.

You can check that by "stat file_name".