Link to home
Start Free TrialLog in
Avatar of TIMFOX123
TIMFOX123Flag for United States of America

asked on

is there a shortcut on the copy command in linux ?

As we know people have been know to make mistakes in VI.  

Before you edit a file it is advisable to back the file up.

I can type cp /etc/vsftpd/vsftpd.conf  /etc/vsftpd/vsftpd.conf.bk

Is there a faster way to do this to not have to type out the target path ( if I an not always in the target directory ? )

Regards;

timfox123

Redhat 5+
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Since you're using RedHat Linux I'm rather sure that your "vi" is in fact "vim".

Under "vim" you can do this:

Create a file called ".exrc" or ".vimrc" in your $HOME directory and add these two lines:

set backup
set backupext=.bk

From now on vim will create a backup file in the same directory as the original file with a name composed of the original name plus the desired extension (here: .bk) before saving any changes to the original file.
Avatar of TIMFOX123

ASKER

Thank you both.

Ozo hit this one perfectly

One last question before I close this ozo ?  How did you know this ( web link ?)

this sure can speed up the process and make typo errors on this command very infrequent
man bash
(or whatever shell you are using)