?
Solved

is there a shortcut on the copy command  in linux ?

Posted on 2014-10-05
4
Medium Priority
?
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 2000 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

PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

Question has a verified solution.

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

Fine Tune your automatic Updates for Ubuntu / Debian
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month15 days, 11 hours left to enroll

741 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