{"id":2676,"date":"2023-03-25T19:54:39","date_gmt":"2023-03-25T14:24:39","guid":{"rendered":"https:\/\/smarttech101.com\/?p=2676"},"modified":"2023-03-25T19:58:53","modified_gmt":"2023-03-25T14:28:53","slug":"copy-command-cp-in-linux-unix","status":"publish","type":"post","link":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/","title":{"rendered":"Copy Command cp in Linux\/Unix"},"content":{"rendered":"\n<p>Copy command <code>cp<\/code> in Linux is used to<strong> copy the contents of a file or directory into another<\/strong> file or directory. Here, I will talk about how you can use copy command cp to copy any files or directory in Linux or Unix-based distros.<\/p>\n\n\n\n<p>Copy command <code>cp<\/code> is one of the most important commands in the<a href=\"https:\/\/smarttech101.com\/how-to-create-shell-scripts-in-linux-unix\/\" target=\"_blank\" rel=\"noreferrer noopener\"> shell scripting<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Table of Contents<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#basic_syntax_in_copy_command_cp_command_in_linux\">Basic syntax in copy command cp in Linux<\/a><\/li>\n\n\n\n<li><a href=\"#options_in_cp_command\">Options in the cp command<\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"#how_to_get_verbose_output_in_cp_command\">How to get verbose output in the cp command<\/a><\/li>\n\n\n\n<li><a href=\"#interactive_mode_in_cp_command\">Interactive mode in the cp command<\/a><\/li>\n\n\n\n<li><a href=\"#how_to_copy_symlinks_in_linux_using_cp_command\">How to copy symlinks in Linux using the cp command<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#how_to_copy_a_directory_in_linuxunix_using_the_cp_command\">How to copy a directory in Linux\/Unix using the cp command<\/a><\/li>\n\n\n\n<li><a href=\"#conclusion\">Conclusion<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"basic_syntax_in_copy_command_cp_command_in_linux\">Basic syntax in copy command cp in Linux<\/h2>\n\n\n\n<p>To copy <code>file1<\/code>&#8216;s content into <code>file2<\/code>, execute the following command. If <code>file2<\/code> exists, its contents are replaced.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ cp file1 file2<\/code><\/pre>\n\n\n\n<p><strong>Example<\/strong>: To replace the contents of <code>replace.txt<\/code> with that of <code>example.txt<\/code>, run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ cp ~\/example.txt ~\/Downloads\/replace.txt<\/code><\/pre>\n\n\n\n<p>If you use a directory name at the place of <code>file2<\/code>, <code>file1<\/code> will be copied to that directory. For example, the following command copies the file <code>~\/example.txt<\/code> to the directory <code>~\/Downloads<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ cp ~\/example.txt ~\/Downloads<\/code><\/pre>\n\n\n\n<p><strong>\ud83d\udcdd Note<\/strong>: To refer to the current directory, use <code>.<\/code> in bash. This applies to all commands, not just the <code>cp<\/code> command. For example, to copy <code>~\/example.txt<\/code> into the current directory viz. <code>~<\/code>, execute the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ pwd\n\/home\/ajay\n\n&#91;ajay@legion ~]$ cp ~\/Downloads\/10th.pdf .<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"options_in_cp_command\">Options in the cp command<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how_to_get_verbose_output_in_cp_command\">How to get verbose output in the cp command<\/h3>\n\n\n\n<p>To get a verbose output from the <code>cp<\/code>, use <code>-v<\/code> or <code>--verbose<\/code> &#8211; it shows what it is doing. Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ cp -v ~\/Downloads\/10th.pdf .\n'\/home\/ajay\/Downloads\/10th.pdf' -&gt; '.\/10th.pdf'<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"interactive_mode_in_cp_command\">The interactive mode in the cp command<\/h3>\n\n\n\n<p>To get interactive output, use <code>-i<\/code> or <code>--interactive<\/code> flag: if you write &#8216;y&#8217; it copies, and for anything else, it does not. Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ cp -v ~\/Downloads\/10th.pdf .\n'\/home\/ajay\/Downloads\/10th.pdf' -&gt; '.\/10th.pdf'\n\n&#91;ajay@legion ~]$ cp -i ~\/Downloads\/10th.pdf .\ncp: overwrite '.\/10th.pdf'? y<\/code><\/pre>\n\n\n\n<p><strong>\ud83d\udcdd Note:<\/strong> You can use both <code>-v<\/code> and <code>-i<\/code> together. For the above example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ cp -vi ~\/Downloads\/10th.pdf .\n'\/home\/ajay\/Downloads\/10th.pdf' -&gt; '.\/10th.pdf'\n\n&#91;ajay@legion ~]$ cp -vi ~\/Downloads\/10th.pdf .\ncp: overwrite '.\/10th.pdf'? y\n'\/home\/ajay\/Downloads\/10th.pdf' -&gt; '.\/10th.pdf'<\/code><\/pre>\n\n\n\n<p><strong>\ud83d\ude42 Note:<\/strong> Both <code>-v<\/code> and <code>-i<\/code> options are available in the commands <code>mv<\/code> and <code>rm<\/code> as well.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how_to_copy_symlinks_in_linux_using_cp_command\">How to copy symlinks in Linux using the cp command<\/h3>\n\n\n\n<p>The <code>cp<\/code> command copies the symlinks like any other file. But it does not create copies of the actual target file.<\/p>\n\n\n\n<p>For example, when I copy a symlink file <code>~\/.Xdefaults<\/code>, only a symlink is created at another place.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ ls -al ~\/.Xdefaults\nlrwxrwxrwx 1 ajay ajay 22 Mar  4  2021 \/home\/ajay\/.Xdefaults -&gt; \/home\/ajay\/.Xresources<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ cp ~\/.Xdefaults \/tmp\n\n&#91;ajay@legion ~]$ ls -al \/tmp\/.Xdefaults         \nlrwxrwxrwx 1 ajay ajay 22 Mar 25 17:47 \/tmp\/.Xdefaults -&gt; \/home\/ajay\/.Xresources<\/code><\/pre>\n\n\n\n<p>To copy the actual target file, you need to use the flag <code>-L<\/code> or <code>--dereference<\/code>. For, <code>~\/.Xdefaults<\/code>, the actual target file is <code>~\/.Xresources<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ cp -L ~\/.Xdefaults \/tmp\/file2.txt<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how_to_copy_a_directory_in_linuxunix_using_the_cp_command\">How to copy a directory in Linux\/Unix using the cp command<\/h2>\n\n\n\n<p>You can also copy one directory into another.<\/p>\n\n\n\n<p>For example, The following commands create a <code>form<\/code> directory into <code>\/tmp\/to<\/code> and copies all content of <code>\/tmp\/from<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ cp -r \/tmp\/from\/ \/tmp\/to\/<\/code><\/pre>\n\n\n\n<p>Please note that I am using the flag <code>-r<\/code> or &#8211;recursive in the above command. That is to tell the <code>cp<\/code> command to copy all the contents of the <code>from<\/code> directory recursively. All directories, files, and everything else inside the directory <code>form<\/code> will be copied. This <code>-r<\/code> flag is available with many basic linux commands such as <code>mv<\/code>, <code>rm<\/code>.<\/p>\n\n\n\n<p>If you don&#8217;t want to create the directory <code>from<\/code> inside the target directory <code>\/tmp\/to<\/code>, use <code>*<\/code> just after the <code>\/<\/code>. It is a special glob in bash. And don&#8217;t use quotes around it.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$ du --all \/tmp\/from \/tmp\/to\n4    \/tmp\/from\/dir1\/file.txt\n4    \/tmp\/from\/dir1\n4    \/tmp\/from\n0    \/tmp\/to\n\n&#91;ajay@legion ~]$ cp -r \/tmp\/from\/* \/tmp\/to\/\n\n&#91;ajay@legion ~]$ du --all \/tmp\/from \/tmp\/to\n4    \/tmp\/from\/dir1\/file.txt\n4    \/tmp\/from\/dir1\n4    \/tmp\/from\n4    \/tmp\/to\/dir1\/file.txt\n4    \/tmp\/to\/dir1\n4    \/tmp\/to<\/code><\/pre>\n\n\n\n<p><strong>\ud83d\udcdd Note:<\/strong> The command <code>du<\/code> in the above example is used to list the contents of one or more directories.<\/p>\n\n\n\n<p>Example 2: <code>cp<\/code> copies all contents of the given <code>...default<\/code> folder into the new <code>...default<\/code> folder without creating <code>&lt;oldrandomnumber&gt;.default<\/code> in the new directory.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@legion ~]$  cp -R \/to\/backup\/folder\/.thunderbird\/&lt;oldrandomnumber&gt;.default\/* ~\/.thunderbird\/&lt;newrandomnumber&gt;.default\/<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>That was a basic introduction to the <code>cp<\/code> command. If you want to learn more, read its manual pages <code>man cp<\/code>, <code>info cp<\/code> and the <a href=\"https:\/\/www.gnu.org\/software\/coreutils\/cp\" target=\"_blank\" rel=\"noreferrer noopener\">official cp documentation<\/a>. <a href=\"https:\/\/smarttech101.com\/backup-and-restore-your-computer-using-rsync\/\" target=\"_blank\" rel=\"noreferrer noopener\">To get a more rigorous copy command, use rsync<\/a> which preserves all metadata of a file (file permissions, ownerships, extended attributes, etc.).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here, I will talk about how you can use copy command cp to copy any files or directory in Linux or Unix based distros.<\/p>\n","protected":false},"author":2,"featured_media":2690,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[17],"tags":[18,35],"class_list":["post-2676","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-command-line-tools","tag-command-line-tools","tag-core-linux-utilities"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Copy Command cp in Linux\/Unix | SmartTech101<\/title>\n<meta name=\"description\" content=\"Here, I will talk about how you can use copy command cp to copy any files or directory in Linux or Unix based distros.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Copy Command cp in Linux\/Unix | SmartTech101\" \/>\n<meta property=\"og:description\" content=\"Here, I will talk about how you can use copy command cp to copy any files or directory in Linux or Unix based distros.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/\" \/>\n<meta property=\"og:site_name\" content=\"SmartTech101\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-25T14:24:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-25T14:28:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smarttech101.com\/wp-content\/uploads\/2023\/03\/Copy-cp-Command-in-LinuxUnix.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ajay\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ajay_yadav\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajay\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/\"},\"author\":{\"name\":\"Ajay\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334\"},\"headline\":\"Copy Command cp in Linux\/Unix\",\"datePublished\":\"2023-03-25T14:24:39+00:00\",\"dateModified\":\"2023-03-25T14:28:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/\"},\"wordCount\":557,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\"},\"image\":{\"@id\":\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/Copy-cp-Command-in-LinuxUnix.png?fit=1280%2C720&ssl=1\",\"keywords\":[\"Command Line Tools\",\"core linux utilities\"],\"articleSection\":[\"Command Line Tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/\",\"url\":\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/\",\"name\":\"Copy Command cp in Linux\/Unix | SmartTech101\",\"isPartOf\":{\"@id\":\"https:\/\/smarttech101.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/Copy-cp-Command-in-LinuxUnix.png?fit=1280%2C720&ssl=1\",\"datePublished\":\"2023-03-25T14:24:39+00:00\",\"dateModified\":\"2023-03-25T14:28:53+00:00\",\"description\":\"Here, I will talk about how you can use copy command cp to copy any files or directory in Linux or Unix based distros.\",\"breadcrumb\":{\"@id\":\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/Copy-cp-Command-in-LinuxUnix.png?fit=1280%2C720&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/Copy-cp-Command-in-LinuxUnix.png?fit=1280%2C720&ssl=1\",\"width\":1280,\"height\":720,\"caption\":\"Copy command cp in Linux\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/smarttech101.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Copy Command cp in Linux\/Unix\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/smarttech101.com\/#website\",\"url\":\"https:\/\/smarttech101.com\/\",\"name\":\"SmartTech101\",\"description\":\"Do Everything in Linux\",\"publisher\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/smarttech101.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\",\"name\":\"Ajay Yadav\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1\",\"width\":180,\"height\":60,\"caption\":\"Ajay Yadav\"},\"logo\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334\",\"name\":\"Ajay\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g\",\"caption\":\"Ajay\"},\"sameAs\":[\"https:\/\/x.com\/ajay_yadav\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Copy Command cp in Linux\/Unix | SmartTech101","description":"Here, I will talk about how you can use copy command cp to copy any files or directory in Linux or Unix based distros.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/","og_locale":"en_US","og_type":"article","og_title":"Copy Command cp in Linux\/Unix | SmartTech101","og_description":"Here, I will talk about how you can use copy command cp to copy any files or directory in Linux or Unix based distros.","og_url":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/","og_site_name":"SmartTech101","article_published_time":"2023-03-25T14:24:39+00:00","article_modified_time":"2023-03-25T14:28:53+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/smarttech101.com\/wp-content\/uploads\/2023\/03\/Copy-cp-Command-in-LinuxUnix.png","type":"image\/png"}],"author":"Ajay","twitter_card":"summary_large_image","twitter_creator":"@ajay_yadav","twitter_misc":{"Written by":"Ajay","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#article","isPartOf":{"@id":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/"},"author":{"name":"Ajay","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334"},"headline":"Copy Command cp in Linux\/Unix","datePublished":"2023-03-25T14:24:39+00:00","dateModified":"2023-03-25T14:28:53+00:00","mainEntityOfPage":{"@id":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/"},"wordCount":557,"commentCount":0,"publisher":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633"},"image":{"@id":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/Copy-cp-Command-in-LinuxUnix.png?fit=1280%2C720&ssl=1","keywords":["Command Line Tools","core linux utilities"],"articleSection":["Command Line Tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/","url":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/","name":"Copy Command cp in Linux\/Unix | SmartTech101","isPartOf":{"@id":"https:\/\/smarttech101.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#primaryimage"},"image":{"@id":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/Copy-cp-Command-in-LinuxUnix.png?fit=1280%2C720&ssl=1","datePublished":"2023-03-25T14:24:39+00:00","dateModified":"2023-03-25T14:28:53+00:00","description":"Here, I will talk about how you can use copy command cp to copy any files or directory in Linux or Unix based distros.","breadcrumb":{"@id":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#primaryimage","url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/Copy-cp-Command-in-LinuxUnix.png?fit=1280%2C720&ssl=1","contentUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/Copy-cp-Command-in-LinuxUnix.png?fit=1280%2C720&ssl=1","width":1280,"height":720,"caption":"Copy command cp in Linux"},{"@type":"BreadcrumbList","@id":"https:\/\/smarttech101.com\/copy-command-cp-in-linux-unix\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smarttech101.com\/"},{"@type":"ListItem","position":2,"name":"Copy Command cp in Linux\/Unix"}]},{"@type":"WebSite","@id":"https:\/\/smarttech101.com\/#website","url":"https:\/\/smarttech101.com\/","name":"SmartTech101","description":"Do Everything in Linux","publisher":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smarttech101.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633","name":"Ajay Yadav","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/","url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1","contentUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1","width":180,"height":60,"caption":"Ajay Yadav"},"logo":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/"}},{"@type":"Person","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334","name":"Ajay","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g","caption":"Ajay"},"sameAs":["https:\/\/x.com\/ajay_yadav"]}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/Copy-cp-Command-in-LinuxUnix.png?fit=1280%2C720&ssl=1","_links":{"self":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2676"}],"collection":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/comments?post=2676"}],"version-history":[{"count":5,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2676\/revisions"}],"predecessor-version":[{"id":2692,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2676\/revisions\/2692"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/media\/2690"}],"wp:attachment":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/media?parent=2676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/categories?post=2676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/tags?post=2676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}