Solved

is there a shortcut on the copy command  in linux ?

Posted on 2014-10-05
4
199 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now