Which command is used to create a duplicate copy of a file while leaving the original file intact

Excel for Microsoft 365 Word for Microsoft 365 PowerPoint for Microsoft 365 Excel for Microsoft 365 for Mac Word for Microsoft 365 for Mac PowerPoint for Microsoft 365 for Mac More...Less

< More collaboration scenarios

Before Microsoft 365, you would edit a file and then use Save As to save your changes as a new document. These days with AutoSave, your changes are always being saved so you won't lose your work. To make sure you don't accidentally save changes in the original file, use Save a Copy BEFORE you start making your edits to ensure you're working on the new copy and not overwriting the original.

Which command is used to create a duplicate copy of a file while leaving the original file intact

Todd's story about AutoSave and Save a Copy

Open the file you want to copy

Inga uses a monthly Excel budget report that she created to keep track of her team’s expenses for reimbursement.

Todd has recently become manager of his own team and wants to keep track of his own monthly expenses. Instead of doing the work from scratch, he decides it would be more efficient to use Inga’s budget report as a template.

Which command is used to create a duplicate copy of a file while leaving the original file intact

Save a Copy to use as a starting point

Todd goes into Inga’s team SharePoint site and opens the Excel budget report for the latest month. Since the spreadsheet is in the cloud, Todd knows that AutoSave will automatically save his changes to the file if he makes them.

Because he doesn’t want to overwrite Inga’s data, before he makes any changes, he goes to File and clicks Save a Copy to download a copy of the report into his OneDrive.

Which command is used to create a duplicate copy of a file while leaving the original file intact

Make changes to your copied file

After saving to his OneDrive, Office automatically opens the file in Excel. Now Todd is working in his version of Inga’s report and is safe to make changes without worrying about changing her data.

He changes the title and cost center number of the report and clears the fields he needs to make it ready for him to fill out. Todd knows that with AutoSave, his report will always save the latest changes.

Which command is used to create a duplicate copy of a file while leaving the original file intact

Discard unwanted edits with Version History

Todd has made several copies of his budget report in preparation for the months ahead. However, he just realized that the report he's been updating with numbers for the next month, is actually the report for last month. Though his changes have been saving automatically over his data, Todd isn't worried because he can Restore a previous version of a file with Version History.

He selects the title of his budget report and selects Version History. He can see the different points in time where Excel has created a version of his file and he opens the one without his accidental changes in a new window. Now, he can easily restore his file with no damage done!

Where is Save As?

Which command is used to create a duplicate copy of a file while leaving the original file intact

Need more help?

This document lists commands for creating, copying, renaming and removing Unix files and directories. It assumes you are using Unix on the ITS Login Service (login.itd.umich.edu). The instructions here apply to many other Unix machines; however, you may notice different behavior if you are not using the ITS Login Service.

What Are Unix Files and Directories?

A file is a "container" for data. Unix makes no distinction among file types—a file may contain the text of a document, data for a program or the program itself.

Directories provide a way to organize files, allowing you to group related files together. Directories may contain files and/or other directories. Directories are analogous to Macintosh and Windows folders.

Naming Unix Files and Directories

Each file and directory has a name. Within a directory, each item (that is, each file or directory) must have a unique name, but items with the same name may exist in more than one directory. A directory may have the same name as one of the items it contains.

File and directory names may be up to 256 characters long. Names may use almost any character (except a space). You can divide a multi-word file name using either an underscore or a period (for example, chapter_one or chapter.two).

Some characters have special meanings to Unix. It is best to avoid using these characters in file names:

/ \ " ' * | ! ? ~ $ < >

Unix is case-sensitive. Each of these is a unique file: myfile, Myfile, myFile, and MYFILE.

Creating a File

Many people create files using a text editor, but you can use the command cat to create files without using/learning to use a text editor. To create a practice file (called firstfile) and enter one line of text in it, type the following at the % prompt:

cat > firstfile
(Press the Enter/Return key.)
This is just a test.
(Press the Enter/Return key.)

Terminate file entry by typing Control-d on a line by itself. (Hold down the Control key and type d.) On your screen, you will see:

% cat > firstfile
This is just a test.
^D

To examine the contents of a file you have just created, enter this at the % prompt:

cat firstfile

Copying a File

To make a duplicate copy of a file, use the command cp. For example, to create an exact copy of the file called firstfile, you would type:

cp firstfile secondfile

This results in two files with different names, each containing the same information. The cp command works by overwriting information. If you create a different file called thirdfile and then type the following command:

cp thirdfile firstfile

you will find that the original contents of firstfile are gone, replaced by the contents of thirdfile.

Renaming a File

Unix does not have a command specifically for renaming files. Instead, the mv command is used both to change the name of a file and to move a file into a different directory.

To change the name of a file, use the following command format (where thirdfile and file3 are sample file names):

mv thirdfile file3

This command results in the complete removal of thirdfile, but a new file called file3 contains the previous contents of thirdfile.

Like cp, the mv command also overwrites existing files. For example, if you have two files, fourthfile and secondfile, and you type the command

mv fourthfile secondfile

mv will remove the original contents of secondfile and replace them with the contents of fourthfile. As a result, fourthfile is renamed secondfile, but in the process secondfile is deleted.

Removing a File

Use the rm command to remove a file. For example,

rm file3

deletes file3 and its contents. You may remove more than one file at a time by specifying a list of files to be deleted. For example,

rm firstfile secondfile

You will be prompted to confirm whether you really want to remove the files:

rm: remove firstfile (y/n)? y
rm: remove secondfile (y/n)? n

Type y or yes to remove a file; type n or no to leave it intact.

Creating a Directory

Creating directories permits you to organize your files. The command

mkdir project1

creates a directory called project1, where you can store files related to a particular project. The directory that you create will be a subdirectory within your current directory. For details on how to navigate directories and display the files and directories they contain, see List Contents and Navigate Unix Directories.

Moving and Copying Files Into a Directory

The mv and cp commands can be used to put files into a directory. Assume that you want to place some files from your current directory into a newly created directory called project1. The command

mv bibliography project1

will move the file bibliography into the directory project1. The command

cp chapter1 project1

will place a copy of the file chapter1 in the directory project1, but leave chapter1 intact in the current directory. There will now be two copies of chapter1, one in the current directory and one in project1.

Renaming a Directory

You can also use the mv command to rename and move directories. When you type the command

mv project1 project2

the directory called project1 will be given the new name project2 as long as a directory called project2 did not previously exist. If directory project2 already existed before the mv command was issued,

mv project1 project2

would move the directory project1 and its files into the directory project2.

Copying a Directory

You can use the cp command to create a duplicate copy of a directory and its contents. To copy directory project1 to directory proj1copy, for example, you would type

cp -r project1 proj1copy

If directory proj1copy already exists, this command will put a duplicate copy of directory project1 into directory proj1copy\.

Removing a Directory

Use the command rmdir to remove an empty directory. Multiple empty directories may be removed by listing them after the command:

rmdir testdir1 testdir2

If you try to remove a directory that is not empty, you will see

rmdir: testdir3: Directory not empty

If you are sure that you want to remove the directory and all the files it contains, use the command

rm -r testdir3

Summary of Commands

Working With Files

  • mv file1 file2
    Renames file1 to file2 (if file2 existed previously, overwrites original contents of file2).

  • cp file1 file2
    Copies file1 as file2 (if file2 existed previously, overwrites original contents of file2).

  • rm file3 file4
    Removes file3 and file4, requesting confirmation for each removal.

Working With Directories

  • mkdir dir1
    Creates a new directory called dir1.

  • mv dir1 dir2
    If dir2 does not exist, renames dir1 to dir2.
    If dir2 exists, moves dir1 inside dir2.

  • cp -r dir1 dir2
    If dir2 does not exist, copies dir1 as dir2.
    If dir2 does exist, copies dir1 inside dir2.

  • rmdir dir1
    Removes dir1, if dir1 contains no files.

  • rm -r dir1
    Removes dir1 and any files it contains. Use with caution.

Working With Files and Directories

  • cp file1 dir1
    Copies file file1 into existing directory dir1.

  • mv file2 dir2
    Moves file file2 into existing directory dir2.

Which of the command places a duplicate copy of the file on the clipboard?

The cut command removes the selected data from its original position, while the copy command creates a duplicate; in both cases the selected data is kept in temporary storage (the clipboard).

What command is used to duplicate content in a document?

Highlight the text you want to copy. Use the shortcut key combination Ctrl + C on a PC or Command + C on a Mac to copy the text. Move the text cursor to where you want to paste the text. Press Ctrl + V on a PC or Command + V on a Mac to paste the text.

When you use the Save command to save changes to a file you overwrite the stored file?

When you use the Save command to save changes to a file, you overwrite the stored file. The last item you cut or copy from a document is added to both the Office Clipboard and the system Clipboard. You can set the Office Clipboard to open automatically any time you cut or copy two items consecutively.

How do you open the Clipboard task pane?

Open the Office Clipboard task pane To open the Clipboard task pane, click Home, and then click the Clipboard dialog box launcher.