Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
12
rated 0 times [  12] [ 0]  / answers: 1 / hits: 3293  / 2 Years ago, wed, april 6, 2022, 6:52:34

I want to quickly create a backup of a file, by creating a duplicate with a '~' at the end, in terminal. Is there any straight forward single command way of doing this?


More From » files

 Answers
0

Create a shell function



backup() {
cp ${1} ${1}~
}


Put it in your shell rc file, for bash it is ~/.bashrc. Source .bashrc or start a new shell.



 . ~/.bashrc
backup youFile


And you have a copy of yourFile.


[#33424] Friday, April 8, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
iething

Total Points: 49
Total Questions: 127
Total Answers: 112

Location: Luxembourg
Member since Tue, Jan 25, 2022
2 Years ago
;