Solved

is there a shortcut on the copy command  in linux ?

Posted on 2014-10-05
4
204 Views
Last Modified: 2014-10-20
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+
0
Comment
Question by:TIMFOX123
  • 2
4 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 40362271
cp /etc/vsftpd/vsftpd.conf{,.bk}
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 40362298
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.
0
 

Author Comment

by:TIMFOX123
ID: 40362512
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
0
 
LVL 84

Expert Comment

by:ozo
ID: 40362600
man bash
(or whatever shell you are using)
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
add some character at the end of line in vi 7 79
Steps to follow for Maintenance of Servers 4 63
linux(debian) mouse poor performance 4 41
CENTOS DHCP Server / PXE/TFTP 14 75
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question