You might be working on a file that is important to you and do not want to mess it up, the best thing to do is backup the file and then do what you want to do just to be on the safe side, lets see example of how to do this using Linux/Unix command,
Option 1: Backup a file using cp command as a new file
# cat my-important-file.txt
This is one of my
very important
text file.
As you can see I have a file that I want to change, but before change it I want to take a backup of It, lets do that using the cp command,
# cp my-important-file.txt my-important-file-backup.txt
As you can see using the copy command, I took a backup of the file my-important-file.txt in a new file that I named as my-important-file-backup.txt, now lets see if the content of the file is same or not,
cat my-important-file-backup.txt
This is one of my
very important
text file.

Option 2: Backup a file with the same name at a different location
# cp my-important-file.txt /home/
# cd /home/
# ls
my-important-file.txt
# cat my-important-file.txt
This is one of my
very important
text file.
- How to Display content of a file in Terminal Screen?
- How to Install CVS Version Control on Linux/Ubuntu
- How to install and Configure sar sysstat tools in Ubuntu Linux
- ls command to list only directories
- [Ubuntu] Search a package and versions using apt command
- zsh hello world example
- Linux Remove or Delete Files and Directories using Terminal Commands
- How to tar.gz a directory or folder Command
- Calculate days between dates using dateutils ddiff command
- How to ls command to output one entry per line [macOS/Linux/Bash]
- 3 Commands to stop Nginx Server
- Create and write file in single Linux/macOS command
- SCP Copy all files from directory to Local Folder
- How to go to the End of File in Nano Editor
- How to remove/delete a directory in Linux/macOs
- How to Copy Entire Directory to another Directory in Linux
- Execute .bin and .run file Ubuntu Linux
- The Date Command and its usage [Linux - Unix - macOS]
- Fix - ssh-copy-id no identities found error
- How to check uptime of Linux/Unix/macOS system/server using console command?
- How to Select All text in vim/vi editor using Keyboard
- Linux: Create a New User and Password and Login Example
- Command to display epoch time Terminal
- How to install curl on Alpine Linux
- How to exit from nano command
- [fix] Java NullPointerException ComparableTimSort countRunAndMakeAscending when sorting a List - Java
- Microsoft Stream - This may not be for you, It looks like you don't have permission to watch this video - Microsoft
- Add Custom header and footer to Windows Notepad file - NotepadPlusPlus
- Android Toast position top - Android
- How to Setup AWS Credentials using Visual Studio Code - AWS
- How to check RAM details on Mac? - MacOS
- Java - PatternSyntaxException - Java
- Indent XML Formatting In Notepad++ - NotepadPlusPlus