Dave's Brain

Browse - Programming Tips - How can I make a datestamp to be used in a file name?

Date: 2016aug23
Language: bash

Q.  How can I make a datestamp to be used in a file name?

A.  The date command can do it.

# Make a date stamp of year - month - day DATE=`date +%Y_%m_%d` # Use it to make a file ps -auxw > /tmp/ps_$DATE.txt

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.