Create backup copy of file, adding suffix of the date of the file modification (NOT today's date)

cp file file.$(date -d @$(stat -c '%Y' file) "+%y%m%d")
When I go to change a configuration file I always like to make a backup first. You can use "cp -p" to preserve the modification time, but it gets confusing to have file.prev, file.prev2, etc. So I like to add a YYMMDD suffix that shows when the file was last changed. "stat -c %Y" gives you the modification time in epoch seconds, then "date -d @" converts that to whatever format you specify in your "+format" string.
Sample Output
# ls -l
-rw-r--r-- 1 root root 0 Dec 31  2018 file
# cp -p file file.$(date -d @$(stat -c '%Y' file) "+%y%m%d")
 ls -l
-rw-r--r-- 1 root root 0 Dec 31  2018 file
-rw-r--r-- 1 root root 0 Dec 31  2018 file.181231
 

3
By: dmmst19
2019-07-18 18:09:09

2 Alternatives + Submit Alt

What Others Think

Just found a site a could relate to home care spokane
aegyjingoo · 65 weeks and 2 days ago
When was this? https://fencecompanylincolnne.net
geebranz · 59 weeks and 4 days ago
If you want to get a bigger profit, then the online credit slot without credit from Pragmatic Play cok toto is the most recommended. Because this provider has many advantages that you should know as a bettor. Among others are:Offers a very generous prize money. These prizes can be in the form of bonuses and jackpots. Even the results of the wins you get are based on the bets you place cok toto
wenilak444 · 30 weeks and 1 day ago
Appreciate it for this grand post, I am glad I noticed this website on yahoo. ???????? ?? ?????????????? ?? ???? ?? ??????
wenilak444 · 30 weeks and 1 day ago
You actually make it seem so easy with your presentation but I find this topic to be actually something that I think I would never understand. It seems too complicated and extremely broad for me. I’m looking forward for your next post, I’ll try to get the hang of it! CEREREA VIZA INDIA
wenilak444 · 29 weeks ago
I conceive you have noted some very interesting details , regards for the post. Kanada Visa ETA
nakav51247 · 27 weeks and 5 days ago
Outstanding read, I just passed this onto a colleague who was doing a little investigation on that. And he really bought me lunch because I discovered it for him smile So let me rephrase that: Thanks for lunch! http://www.HubslotXO.com
wenilak444 · 27 weeks and 1 day ago
I’m having a weird problem I cannot make my reader pick up your feed, I’m using google reader fyi. www.Parisclub888.com
nakav51247 · 26 weeks and 4 days ago
Explore revexpo, A Indian review website, Their article will help you to pick the right helmet camera along with a proper buying guide. A helmet camera is a most useful and very famous gadget in today s generation Also called a micro video camera or a closed circuit camera. They have listed the best Ladies Helmet & Helmets for Men along with a buyers guide.
KayGasaway · 26 weeks and 2 days ago
Discover mini mesh chain link fence, ASX METALS LTD are a leading wire mesh and fence manufacturer in China Verified 13 Years Golden Supplier by Alibaba, mini mesh chain link fence ?is a kind of sturdy, high-security fence with small mesh sizes. Visit website and Get your quote now! Thank You.
ayesha · 26 weeks and 2 days ago
mini dresses for women Welcome to First Choice Fashion where our goal is to provide the best quality products to our customers. https://firstchoicefashionstore.com/
KayGasaway · 26 weeks ago
It is really a great and useful piece of info. I am glad that you shared this useful information with us. Please keep us informed like this. Thanks for sharing. [url=https://www.canada-visa-online.org/pt/guia-turístico-de-praias-famosas-de-Montreal/]Canada Visa Online[/url]
nakav51247 · 25 weeks and 6 days ago
Thanks a ton for your efforts to have decided to put these things together on this site. Janet and i also very much liked your suggestions through the articles with certain things. I understand that you have a number of demands on your program therefore the fact that an individual like you took just as much time just like you did to steer people like us through this article is even highly prized. ?????? sexy gaming
wenilak444 · 25 weeks and 6 days ago
Visit Ocala.Church to make preparations for your visit to our Ocala Church Campus. Discover events in ocala this weekend and Midweek Church Worship and Bible Study Times all on the Ocala.Church Home Page. events in ocala this weekend
nakav51247 · 25 weeks and 4 days ago
Looking for Best & Approved Skin whitening Injection? Shop now the miraculous and wonderful whitening Dr James Glutathione Injection ?which is known to be one of the best ones in today's entire skincare market. They are prepared with Glutathione's highest efficiency, which ensures that it perfectly does its job and shows a visible difference to the people who use it in a short time!
KayGasaway · 24 weeks and 6 days ago
Good write-up, I’m regular visitor of one’s site, maintain up the excellent operate, and It’s going to be a regular visitor for a lengthy time. ???? ????
nakav51247 · 24 weeks and 6 days ago
OppTy is a smart, intuitive and powerful career guidance platform your hiring team will love to use. OppTy will be your go to platform for all things related to career from career planning, career test, career counselling, career advice, career builder, recruitment, to job applications. career planning
KayGasaway · 24 weeks and 6 days ago
Permit Studio is permit expediting services and permit management company in Chicago. We are offering the 36 different Permit expediting services in Chicago. We can help you with an array of permit expediting and permit management tasks in Chicago. Adding us to your team will save you time and keep you from making some costly mistakes. chicago permit services
KayGasaway · 24 weeks ago
An affordable collection of Sterling Silver Earrings for Women , Silver earrings for women, Moissanite Stud earrings for women & Silver hoop earrings for Women. Inexpensive & Cheap Earrings for all Occasions.
nakav51247 · 23 weeks and 6 days ago
Explore Clinic Review - And get supplement reviews , You will find verified reviews on this website topics like: Fat burners Products, Cacao Bliss Reviews, Detailed Analysis On Toenail Fungus Cure Formula!, Effective Ingredients or Cheap Blood Sugar Pills? and more, Please click the mentioned anchor texts to visit this informative and valid website for authorized reviews about supplements.
wenilak444 · 23 weeks and 6 days ago
Explore effective treatments ?for your health problems, This website review products that solve the problem you have, If you don’t see a solution or treatment for your problem, feel free to submit a request for a product that you want to be reviewed by our specialists by visiting our website. Thank You.
nakav51247 · 23 weeks and 6 days ago
Explore Need Health - The Best Place To Aquire The Needed Health, Visit our website to get info about the best brain health supplement review, As We are constantly learning about how amazing the human brain is. It’s many more powerful than even the latest, most advanced technology.s. While you can’t live in fear of injury, you can stay on top of your health to minimize the odds of developing an issue, and to know what actions to take if something goes wrong.
nakav51247 · 23 weeks and 6 days ago
where to get shrooms dried mushrooms african pyramid mushroom african transkei mushroom albino penis envy b+ mushrooms blue meanies mushroom brazilian magic mushroom burmese mushroom golden teacher mushroom ko samui super strain malabar coast martinique mexican mushroom mushroom british columbia super thai mushroom nepalese chitwan mushroom penis envy texas penis envy 6 texas yellow caps vietnamese white jedi mind fuck tri coloured ecuadorian mushroom magic mushsroom edibles mexican cubensis psychedelic chocolate bar where to get shrooms dried mushrooms african pyramid mushroom african transkei mushroom albino penis envy b+ mushrooms blue meanies mushroom brazilian magic mushroom burmese mushroom golden teacher mushroom ko samui super strain malabar coast martinique mexican mushroom mushroom british columbia super thai mushroom nepalese chitwan mushroom penis envy texas penis envy 6 texas yellow caps vietnamese white jedi mind fuck tri coloured ecuadorian mushroom magic mushsroom edibles mexican cubensis psychedelic chocolate bar midnight mint psychedelic chocolate bar origin mango psilo gummies 0.25g-1g origin strawberry psilo gummies 0.25g-1g penis envy psychedelic chocolate bar psilocybin cube gummies vegan dark chocolate psychedelic chocolate bar microdoses brain capsules 50mg-200mg chill capsules 50mg-200mg clarity capsules 50mg-200mg health capsules 50mg-200mg love capsules 50mg-200mg mood capsules 50mg-200mg pure capsules 50mg-200mg social capsules 30 pack 350mg social capsules 5 pack 350mg
johnson20007 · 22 weeks and 1 day ago
cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber cfiber fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers fox fiber construfiber fiboverview overview overview steel overview buy polysterfibers cfiber fox fiber construfiber fiboverview overview overview
steelfiber · 18 weeks and 1 day ago
IT LABS PRO est la meilleure société de services d'ingénierie informatique au Maroc, en vous déplaçant à son siège à Marrakech - gueliz vous allez bénéficier des meilleurs services de création de sites et applications de gestion web, cette dernière privilégie ses clients et mettez à leur disposition toutes ses ressources pour l'accomplissement de leurs projets tout en offrant son expertise en conseillant ses clients et les accompagnant pour améliorer leurs images sur intérêt et mieux gérer leurs business. Creation site web maroc
itlabspro · 14 weeks and 3 days ago
If you want to buy a new premium design coat so here's we have Sienna Miller Poncho Style Coat which we made from high-quality wool fabric and the quality of this amazing Sienna Miller Poncho will never disappoint you so why are you thinking anymore buy this stunning poncho-style coat now.
emmawatson3848 · 4 weeks and 2 days ago
Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com - Commandlinefu.Com
seofox · 3 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: