aeeble aeeble

Login

Use WebServerTalk’s Linux guide to make a copy without replacing a file

When you want a second copy of a text file for review, the destination may already contain a file with the same name. WebServerTalk publishes Linux and Windows guides, software reviews and comparisons. Its Linux file-copying tutorial gives a starting point for learning how to handle that name collision in a terminal.

Try the prompt with two sample files

Create a practice folder in your home directory with a text file named sample.txt and a subfolder named preview. Put a second file named sample.txt in preview and give it different text. In a terminal opened in the practice folder, run cp -i sample.txt preview/. With GNU cp, the interactive option prompts before overwriting the existing copy.

Decline the prompt and open both files. The one in preview should still show its original text. Now use cp -i sample.txt review-copy.txt to give the new copy its own name. Open it and check that it contains the source text.

Confirm the behavior before using your real files

The GNU Coreutils manual explains which argument names the source and which names the destination, and when the interactive prompt applies. Use the practice result to check your understanding, then name your destination explicitly. For other WebServerTalk walkthroughs, check the publication date and verify any option you plan to use against the relevant software manual.

Images
Ratings
Related Lists