Cancel mv after execution

Chris Tyler chris at tylers.info
Sun Aug 24 13:07:26 UTC 2008


On Sat, 23 Aug 2008 21:07:03 -0700, Russell Miller wrote:
> 
> Adil Drissi wrote:
> > Hi,
> >
> > Is it possible to cancel one command after execution?
> > my command was :
> > mv includes ../includes
> >
> > i was in /var/www so if a directory includes already existed in /var
> it was replaced. 
> >
> > Thank you
> >
> >   
> It wasn't replaced, it was put inside of it.
> 
> You now have a ../includes/includes directory.
> 
> Also, to cancel it, you press control and "C" - however, in the case of 
> commands such as mv and cp, you'll find the operation half done and will 
> usually have to clean up after it.

In addition to Russell's suggestion of using Ctrl-C to stop the
operation, you may want to consider using the -i and -v options with mv
(and cp and rm) so that you can see exactly which paths the commands are
operating on and so that you will be prompted for confirmation before
any destructive operations are performed.

If you want to consistently use those options but not type them every
time, you can add them to an alias:

  alias mv="mv -iv"

This will take effect for the duration of the current shell. To make the
alias persistent, place the line above in ~/.bashrc

-Chris




More information about the fedora-list mailing list