summaryrefslogtreecommitdiffstats
path: root/slackbook/html/file-commands-copymove.html
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2009-08-26 10:00:38 -0500
committer Eric Hameleers <alien@slackware.com>2018-05-31 22:41:17 +0200
commit5a12e7c134274dba706667107d10d231517d3e05 (patch)
tree55718d5acb710fde798d9f38d0bbaf594ed4b296 /slackbook/html/file-commands-copymove.html
downloadcurrent-5a12e7c134274dba706667107d10d231517d3e05.tar.gz
current-5a12e7c134274dba706667107d10d231517d3e05.tar.xz
Slackware 13.0slackware-13.0
Wed Aug 26 10:00:38 CDT 2009 Slackware 13.0 x86_64 is released as stable! Thanks to everyone who helped make this release possible -- see the RELEASE_NOTES for the credits. The ISOs are off to the replicator. This time it will be a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. We're taking pre-orders now at store.slackware.com. Please consider picking up a copy to help support the project. Once again, thanks to the entire Slackware community for all the help testing and fixing things and offering suggestions during this development cycle. As always, have fun and enjoy! -P.
Diffstat (limited to 'slackbook/html/file-commands-copymove.html')
-rw-r--r--slackbook/html/file-commands-copymove.html166
1 files changed, 166 insertions, 0 deletions
diff --git a/slackbook/html/file-commands-copymove.html b/slackbook/html/file-commands-copymove.html
new file mode 100644
index 000000000..ddb7179a9
--- /dev/null
+++ b/slackbook/html/file-commands-copymove.html
@@ -0,0 +1,166 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta name="generator" content="HTML Tidy, see www.w3.org" />
+<title>Copy and Move</title>
+<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
+<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
+<link rel="UP" title="Handling Files and Directories" href="file-commands.html" />
+<link rel="PREVIOUS" title="Creation: touch and mkdir"
+href="file-commands-creation.html" />
+<link rel="NEXT" title="Deletion: rm and rmdir" href="file-commands-deletion.html" />
+<link rel="STYLESHEET" type="text/css" href="docbook.css" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+</head>
+<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
+alink="#0000FF">
+<div class="NAVHEADER">
+<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
+cellspacing="0">
+<tr>
+<th colspan="3" align="center">Slackware Linux Essentials</th>
+</tr>
+
+<tr>
+<td width="10%" align="left" valign="bottom"><a href="file-commands-creation.html"
+accesskey="P">Prev</a></td>
+<td width="80%" align="center" valign="bottom">Chapter 10 Handling Files and
+Directories</td>
+<td width="10%" align="right" valign="bottom"><a href="file-commands-deletion.html"
+accesskey="N">Next</a></td>
+</tr>
+</table>
+
+<hr align="LEFT" width="100%" />
+</div>
+
+<div class="SECT1">
+<h1 class="SECT1"><a id="FILE-COMMANDS-COPYMOVE" name="FILE-COMMANDS-COPYMOVE">10.5 Copy
+and Move</a></h1>
+
+<div class="SECT2">
+<h2 class="SECT2"><a id="FILE-COMMANDS-COPYMOVE-CP"
+name="FILE-COMMANDS-COPYMOVE-CP">10.5.1 <tt class="COMMAND">cp</tt></a></h2>
+
+<p><tt class="COMMAND">cp</tt>(1) copies files. DOS users will notice its similarity to
+the <tt class="COMMAND">copy</tt> command. There are many options for <tt
+class="COMMAND">cp</tt> , so you should have a look at the man page before using it.</p>
+
+<p>A common use is to use <tt class="COMMAND">cp</tt> to copy a file from one location to
+another. For example:</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cp hejaz /tmp</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p>This copies the <tt class="FILENAME">hejaz</tt> file from the current directory to the
+<tt class="FILENAME">/tmp</tt> directory.</p>
+
+<p>Many users prefer to keep the timestamps preserved, as in this example:</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cp -a hejaz /tmp</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p>This ensures that the timestamps are not modified in the copy.</p>
+
+<p>To recursively copy the contents of a directory to another directory, you would issue
+this command:</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cp -R <var
+class="REPLACEABLE">mydir</var> /tmp</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p>That will copy the <var class="REPLACEABLE">mydir</var> directory to the <tt
+class="FILENAME">/tmp</tt> directory.</p>
+
+<p>Also if you wish to copy a directory or a file and keep all it's old permissions and
+time stamps and keep it exactly the same use <tt class="COMMAND">cp -p</tt>.</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l file</kbd>
+-rw-r--r-- 1 root vlad 4 Jan 1 15:27 file
+<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cp -p file /tmp</kbd>
+<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l /tmp/file</kbd>
+-rw-r--r-- 1 root vlad 4 Jan 1 15:27 file
+</pre>
+</td>
+</tr>
+</table>
+
+<p><tt class="COMMAND">cp</tt> has many more options that are discussed in detail in the
+online manual page.</p>
+</div>
+
+<div class="SECT2">
+<h2 class="SECT2"><a id="AEN3712" name="AEN3712">10.5.2 <tt
+class="COMMAND">mv</tt></a></h2>
+
+<p><tt class="COMMAND">mv</tt>(1) moves files from one place to another. Sounds simple
+enough doesn't it?</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">%</samp> <kbd class="USERINPUT">mv oldfile /tmp/newfile</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p><tt class="COMMAND">mv</tt> has a few useful command line options that are detailed in
+the man page. In practice, <tt class="COMMAND">mv</tt> is almost never used with
+commandline options.</p>
+</div>
+</div>
+
+<div class="NAVFOOTER">
+<hr align="LEFT" width="100%" />
+<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
+cellspacing="0">
+<tr>
+<td width="33%" align="left" valign="top"><a href="file-commands-creation.html"
+accesskey="P">Prev</a></td>
+<td width="34%" align="center" valign="top"><a href="index.html"
+accesskey="H">Home</a></td>
+<td width="33%" align="right" valign="top"><a href="file-commands-deletion.html"
+accesskey="N">Next</a></td>
+</tr>
+
+<tr>
+<td width="33%" align="left" valign="top">Creation: <tt class="COMMAND">touch</tt> and
+<tt class="COMMAND">mkdir</tt></td>
+<td width="34%" align="center" valign="top"><a href="file-commands.html"
+accesskey="U">Up</a></td>
+<td width="33%" align="right" valign="top">Deletion: <tt class="COMMAND">rm</tt> and <tt
+class="COMMAND">rmdir</tt></td>
+</tr>
+</table>
+</div>
+</body>
+</html>
+