The Tech Edvocate

Top Menu

  • Advertisement
  • Apps
  • Home Page
  • Home Page Five (No Sidebar)
  • Home Page Four
  • Home Page Three
  • Home Page Two
  • Home Tech2
  • Icons [No Sidebar]
  • Left Sidbear Page
  • Lynch Educational Consulting
  • My Account
  • My Speaking Page
  • Newsletter Sign Up Confirmation
  • Newsletter Unsubscription
  • Our Brands
  • Page Example
  • Privacy Policy
  • Protected Content
  • Register
  • Request a Product Review
  • Shop
  • Shortcodes Examples
  • Signup
  • Start Here
    • Governance
    • Careers
    • Contact Us
  • Terms and Conditions
  • The Edvocate
  • The Tech Edvocate Product Guide
  • Topics
  • Write For Us
  • Advertise

Main Menu

  • Start Here
    • Our Brands
    • Governance
      • Lynch Educational Consulting, LLC.
      • Dr. Lynch’s Personal Website
      • Careers
    • Write For Us
    • The Tech Edvocate Product Guide
    • Contact Us
    • Books
    • Edupedia
    • Post a Job
    • The Edvocate Podcast
    • Terms and Conditions
    • Privacy Policy
  • Topics
    • Assistive Technology
    • Child Development Tech
    • Early Childhood & K-12 EdTech
    • EdTech Futures
    • EdTech News
    • EdTech Policy & Reform
    • EdTech Startups & Businesses
    • Higher Education EdTech
    • Online Learning & eLearning
    • Parent & Family Tech
    • Personalized Learning
    • Product Reviews
  • Advertise
  • Tech Edvocate Awards
  • The Edvocate
  • Pedagogue
  • School Ratings

logo

The Tech Edvocate

  • Start Here
    • Our Brands
    • Governance
      • Lynch Educational Consulting, LLC.
      • Dr. Lynch’s Personal Website
        • My Speaking Page
      • Careers
    • Write For Us
    • The Tech Edvocate Product Guide
    • Contact Us
    • Books
    • Edupedia
    • Post a Job
    • The Edvocate Podcast
    • Terms and Conditions
    • Privacy Policy
  • Topics
    • Assistive Technology
    • Child Development Tech
    • Early Childhood & K-12 EdTech
    • EdTech Futures
    • EdTech News
    • EdTech Policy & Reform
    • EdTech Startups & Businesses
    • Higher Education EdTech
    • Online Learning & eLearning
    • Parent & Family Tech
    • Personalized Learning
    • Product Reviews
  • Advertise
  • Tech Edvocate Awards
  • The Edvocate
  • Pedagogue
  • School Ratings
  • Ramp’s Staggering $60 Billion Valuation: 8 Reasons Why Investors Are Piling In

  • Uncovering the Cost: Why This AI Startup’s Collapse Is a Troubling Sign for Tech

  • The Silent Crisis: Why Your Next Console Will Cost a Fortune

  • Advisers urged to steer clear of ‘hyperscale’ AI models

  • The Quiet Crisis: Is AI in Education Creating an ‘Illusion of Learning’?

  • 84% of Ransomware Attacks Use AI: This Is How Your Own Systems Are Turning Against You

  • The Staggering Truth About Healthcare Cyberattacks: 76.6 Million Records Exposed in 2026

  • This Crucial Deadline For Rogue AI Is Much Closer Than You Think

  • This RNA Breakthrough Could Rewrite Alzheimer’s Treatment

  • This One Thing Is Silently Crushing US Consumer Inflation — And Your Wallet

Assistive Technology
Home›Assistive Technology›How to Copy Files in Linux With the cp Command

How to Copy Files in Linux With the cp Command

By Matthew Lynch
June 23, 2023
0
Spread the love

Copying files in Linux is an everyday task for many users. Whether it’s for backing up important files or transferring data between systems, the cp command is one of the most commonly used commands in Linux for the purpose of copying files. In this article, we will explore the basics of how to copy files in Linux with the cp command.

Copying a Single File

To copy a single file in Linux, the cp command is used with the following syntax:

cp source_file destination_file

In this command, replace the “source_file” with the name of the file you want to copy, and “destination_file” with the name of the new file you want to create. For example, to copy a file named “file.txt” located in the home directory to a new file named “new_file.txt”, we would use the following command:

cp ~/file.txt ~/new_file.txt

This command will create a copy of “file.txt” in the home directory with the name “new_file.txt”.

Copying Multiple Files

To copy multiple files in Linux, you can use the same cp command with the following syntax:

cp source_file1 source_file2 … source_fileN destination_directory

In this command, we need to list all the files we wish to copy followed by the name of the directory where we want to create the copy of those files. For example, to copy two files named “file1.txt” and “file2.txt” located in the home directory to a directory named “backup” located in the same directory, we would use the following command:

cp ~/file1.txt ~/file2.txt ~/backup/

This command will create copies of the specified files in the “backup” directory located in the home directory.

Preserving File Attributes

Often, it’s important to preserve the file attributes such as the original file’s timestamps, ownership, permissions, and many more. We can preserve these attributes while copying the files with the “-p” or “–preserve” option. The syntax of the command is as follows:

cp -p source_file destination_file

For example, to preserve all the attributes of the file “file1.txt” while copying it to a new file “new_file1.txt”, we would use the following command:

cp -p file1.txt new_file1.txt

Copying Directories

Copying directories is a bit different than copying files because directories can contain multiple files and subdirectories. To copy a directory in Linux, we use the “-r” or “–recursive” option with the cp command. The syntax of the command is as follows:

cp -r source_directory destination_directory

For example, to copy all files and subdirectories from a directory named “src” located in the home directory to a new directory named “dst” located in the same directory, we would use the following command:

cp -r ~/src/ ~/dst/

Previous Article

How to Set Up MSI Afterburner to ...

Next Article

How to Add a Ring Doorbell to ...

Matthew Lynch

Related articles More from author

  • Assistive Technology

    How to Remove Header in Google Docs

    June 12, 2023
    By Matthew Lynch
  • Assistive Technology

    How to Use Roku Parental Controls

    June 12, 2023
    By Matthew Lynch
  • Assistive Technology

    How to Start a YouTube Channel without a Proper Camera

    June 5, 2023
    By Matthew Lynch
  • Assistive Technology

    How to Fix It When a Laptop Isn’t Connecting to a Mobile Hotspot

    June 6, 2023
    By Matthew Lynch
  • Assistive Technology

    How to Perform a Windows XP Repair Install

    June 12, 2023
    By Matthew Lynch
  • Assistive Technology

    Loop a PowerPoint Slide Show

    June 10, 2023
    By Matthew Lynch

Search

Login & Registration

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Newsletter

Signup for The Tech Edvocate Newsletter and have the latest in EdTech news and opinion delivered to your email address!

About Us

Since technology is not going anywhere and does more good than harm, adapting is the best course of action. That is where The Tech Edvocate comes in. We plan to cover the PreK-12 and Higher Education EdTech sectors and provide our readers with the latest news and opinion on the subject. From time to time, I will invite other voices to weigh in on important issues in EdTech. We hope to provide a well-rounded, multi-faceted look at the past, present, the future of EdTech in the US and internationally.

We started this journey back in June 2016, and we plan to continue it for many more years to come. I hope that you will join us in this discussion of the past, present and future of EdTech and lend your own insight to the issues that are discussed.

Newsletter

Signup for The Tech Edvocate Newsletter and have the latest in EdTech news and opinion delivered to your email address!

Contact Us

The Tech Edvocate
910 Goddin Street
Richmond, VA 23231
(601) 630-5238
[email protected]

Copyright © 2026 Matthew Lynch. All rights reserved.