Small Mosaic


Categories:

/books
/career
/codinghorrors
/events
/geekstuff
/justdont
/languages
/languages/bash
/linkshot
/magazines
/meta
/misctech
/movies
/nottech
/operatingsystems
/operatingsystems/linux
/operatingsystems/linux/debian
/operatingsystems/solaris
/perl
/presentations
/programming
/python
/ruby
/security
/security/apache
/security/tools
/serversmells
/services
/services/dns
/sites
/specifications
/sysadmin
/testing
/tools
/tools/commandline
/tools/firefox
/tools/gui
/tools/network
/tools/online
/tools/online/greasemonkey
/tools/puppet
/unixdaemon

Archives:

July 20111
June 20112
May 20113
April 20112
March 20117
January 20111
December 20103
November 20103
August 20101
July 20101
June 20104
May 20102
April 20101
March 20108
February 20101
January 20102
Full Archives

Wed, 28 Jun 2006

Short File Copy Command Line
Making a backup copy of a file is a pretty common thing to do (although you should be using RCS for a lot of these...). If you're using a machine with a GUI then copy and pasting the file name twice, with an extension on the end, is pretty simple. If you're either a keyboard jockey or without a mouse you can make your life easier with these two short cuts:

# make a copy of file. add the .old extension
cp filename{,-old}


# overwrite the old version with the new version
cp filename{-old,}


# make a backup of a file deep in a directory tree. The copy
# is in the remote directory, not the working one.
cp /var/www/www.unixdaemon.net/htdocs/index.html{,-old}

It's not a huge saving until you find yourself with long filenames, working on a machine without a GUI but it is a useful trick to know.

Like this post? - Digg Me! | Add to del.icio.us! | reddit this!

Posted: 2006/06/28 17:47 | /tools/commandline | Permanent link to this entry | This entry and same date


books career codinghorrors events geekstuff justdont magazines meta misctech movies nottech operatingsystems/linux operatingsystems/linux/debian operatingsystems/solaris perl programming python ruby security security/apache security/tools serversmells services/dns sites sysadmin testing tools tools/commandline tools/firefox tools/gui tools/network tools/online tools/online/greasemonkey tools/puppet unixdaemon

Copyright © 2000-2010 Dean Wilson XML feed logo