In Linux how to make a file with a name that is current date and time

Solution 1:

Use the return value from a shell expression as the argument to touch:

touch $( date '+%Y-%m-%d_%H-%M-%S' )

Result: A file named e.g. 2012-03-11_14-33-53.

This answer assumes you're using bash (it's described in the man page section Command Substitution), but other shells will work the same or only slightly different.