-
Notifications
You must be signed in to change notification settings - Fork 0
/
Comandos_de_la_terminal%2Fcp.mw
228 lines (188 loc) · 10.5 KB
/
Comandos_de_la_terminal%2Fcp.mw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
__NOTOC__
* [[:#cp | cp]]
== cp ==
<syntaxhighlight lang="bash">
[rrc@pridd ~]$ cp --help
Usage: cp [OPTION]... [-T] SOURCE DEST
or: cp [OPTION]... SOURCE... DIRECTORY
or: cp [OPTION]... -t DIRECTORY SOURCE...
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
Mandatory arguments to long options are mandatory for short options too.
-a, --archive same as -dR --preserve=all
--attributes-only don't copy the file data, just the attributes
--backup[=CONTROL] make a backup of each existing destination file
-b like --backup but does not accept an argument
--copy-contents copy contents of special files when recursive
-d same as --no-dereference --preserve=links
-f, --force if an existing destination file cannot be
opened, remove it and try again (this option
is ignored when the -n option is also used)
-i, --interactive prompt before overwrite (overrides a previous -n
option)
-H follow command-line symbolic links in SOURCE
-l, --link hard link files instead of copying
-L, --dereference always follow symbolic links in SOURCE
-n, --no-clobber do not overwrite an existing file (overrides
a previous -i option)
-P, --no-dereference never follow symbolic links in SOURCE
-p same as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST] preserve the specified attributes (default:
mode,ownership,timestamps), if possible
additional attributes: context, links, xattr,
all
--no-preserve=ATTR_LIST don't preserve the specified attributes
--parents use full source file name under DIRECTORY
-R, -r, --recursive copy directories recursively
--reflink[=WHEN] control clone/CoW copies. See below
--remove-destination remove each existing destination file before
attempting to open it (contrast with --force)
--sparse=WHEN control creation of sparse files. See below
--strip-trailing-slashes remove any trailing slashes from each SOURCE
argument
-s, --symbolic-link make symbolic links instead of copying
-S, --suffix=SUFFIX override the usual backup suffix
-t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY
-T, --no-target-directory treat DEST as a normal file
-u, --update copy only when the SOURCE file is newer
than the destination file or when the
destination file is missing
-v, --verbose explain what is being done
-x, --one-file-system stay on this file system
--help display this help and exit
--version output version information and exit
By default, sparse SOURCE files are detected by a crude heuristic and the
corresponding DEST file is made sparse as well. That is the behavior
selected by --sparse=auto. Specify --sparse=always to create a sparse DEST
file whenever the SOURCE file contains a long enough sequence of zero bytes.
Use --sparse=never to inhibit creation of sparse files.
When --reflink[=always] is specified, perform a lightweight copy, where the
data blocks are copied only when modified. If this is not possible the copy
fails, or if --reflink=auto is specified, fall back to a standard copy.
The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control method may be selected via the --backup option or through
the VERSION_CONTROL environment variable. Here are the values:
none, off never make backups (even if --backup is given)
numbered, t make numbered backups
existing, nil numbered if numbered backups exist, simple otherwise
simple, never always make simple backups
As a special case, cp makes a backup of SOURCE when the force and backup
options are given and SOURCE and DEST are the same name for an existing,
regular file.
Report cp bugs to [email protected]
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'cp invocation'
[rrc@pridd ~]$ cp --version
cp (GNU coreutils) 8.21
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Torbjörn Granlund, David MacKenzie, and Jim Meyering.
[rrc@Llawyr ComandosDeLaTerminal]$ alias cp
alias cp='cp -i'
[rrc@Llawyr ComandosDeLaTerminal]$ unalias cp
[rrc@Llawyr ComandosDeLaTerminal]$ cp SortFile Archivo1
[rrc@Llawyr ComandosDeLaTerminal]$ diff SortFile Archivo1
[rrc@Llawyr ComandosDeLaTerminal]$ alias cp='cp -i'
[rrc@Llawyr ComandosDeLaTerminal]$ alias cp
alias cp='cp -i'
[rrc@Llawyr ComandosDeLaTerminal]$ cp SortFile Archivo1
cp: overwrite ‘Archivo1’? y
[root@Llawyr ComandosDeLaTerminal]# cp /var/www/html/richard/index
index.es.html index.html
[root@Llawyr ComandosDeLaTerminal]# cp /var/www/html/richard/index.html .
[root@Llawyr ComandosDeLaTerminal]# ls -al /var/www/html/richard/index.html
-rw-rw-r-- 1 rrc webmin 13242 Jun 25 2008 /var/www/html/richard/index.html
[root@Llawyr ComandosDeLaTerminal]# ls -al index.html
-rw-r--r-- 1 root root 13242 Apr 4 14:38 index.html
[root@Llawyr ComandosDeLaTerminal]# cp -p /var/www/html/richard/index.html index2.html
[root@Llawyr ComandosDeLaTerminal]# ls -al index2.html
-rw-rw-r-- 1 rrc webmin 13242 Jun 25 2008 index2.html
[root@Llawyr ComandosDeLaTerminal]# cp -s index.html index-s.html
[root@Llawyr ComandosDeLaTerminal]# ls -al index-s.html
lrwxrwxrwx 1 root root 10 Apr 4 14:49 index-s.html -> index.html
[root@Llawyr ComandosDeLaTerminal]# cp /var/www/html/richard .
cp: omitting directory ‘/var/www/html/richard’
[root@Llawyr ComandosDeLaTerminal]# ls -al richard
ls: cannot access richard: No such file or directory
[root@Llawyr ComandosDeLaTerminal]# cp -r /var/www/html/richard richard2
[root@Llawyr ComandosDeLaTerminal]# ls -al richard2
total 72
drwxr-xr-x 3 root root 4096 Apr 4 14:54 ./
drwx------ 18 rrc rrc 4096 Apr 4 14:54 ../
-rw-r--r-- 1 root root 3320 Apr 4 14:54 evolution.es.html
-rw-r--r-- 1 root root 3272 Apr 4 14:54 evolution.html
drwxr-xr-x 2 root root 4096 Apr 4 14:54 images/
-rw-r--r-- 1 root root 14700 Apr 4 14:54 index.es.html
-rw-r--r-- 1 root root 13242 Apr 4 14:54 index.html
-rw-r--r-- 1 root root 4329 Apr 4 14:54 RichardSleeve.es.html
-rw-r--r-- 1 root root 4328 Apr 4 14:54 RichardSleeve.html
-rw-r--r-- 1 root root 489 Apr 4 14:54 robots.txt
[root@Llawyr ComandosDeLaTerminal]# ls -al /var/www/html/richard
total 72
drwxrwsr-x 3 rrc webmin 4096 Jun 20 2013 ./
drwxr-xr-x 20 root root 4096 Oct 18 18:29 ../
-rw-rw-r-- 1 rrc webmin 3320 Jun 25 2008 evolution.es.html
-rw-rw-r-- 1 rrc webmin 3272 Jun 25 2008 evolution.html
drwxrwsr-x 2 rrc webmin 4096 Jul 8 2008 images/
-rw-rw-r-- 1 rrc webmin 14700 Jul 10 2008 index.es.html
-rw-rw-r-- 1 rrc webmin 13242 Jun 25 2008 index.html
-rw-rw-r-- 1 rrc webmin 4329 Jun 25 2008 RichardSleeve.es.html
-rw-rw-r-- 1 rrc webmin 4328 Jun 25 2008 RichardSleeve.html
-rw-rw-r-- 1 rrc webmin 489 Jun 20 2013 robots.txt
[root@Llawyr ComandosDeLaTerminal]# cp -a /var/www/html/richard richard3
[root@Llawyr ComandosDeLaTerminal]# ls -al richard3
total 72
drwxrwsr-x 3 rrc webmin 4096 Jun 20 2013 ./
drwx------ 17 rrc rrc 4096 Apr 4 14:46 ../
-rw-rw-r-- 1 rrc webmin 3320 Jun 25 2008 evolution.es.html
-rw-rw-r-- 1 rrc webmin 3272 Jun 25 2008 evolution.html
drwxrwsr-x 2 rrc webmin 4096 Jul 8 2008 images/
-rw-rw-r-- 1 rrc webmin 14700 Jul 10 2008 index.es.html
-rw-rw-r-- 1 rrc webmin 13242 Jun 25 2008 index.html
-rw-rw-r-- 1 rrc webmin 4329 Jun 25 2008 RichardSleeve.es.html
-rw-rw-r-- 1 rrc webmin 4328 Jun 25 2008 RichardSleeve.html
-rw-rw-r-- 1 rrc webmin 489 Jun 20 2013 robots.txt
[root@Llawyr ComandosDeLaTerminal]# cp -u /var/www/html/richard/* richard2
cp: omitting directory ‘/var/www/html/richard/images’
[root@Llawyr ComandosDeLaTerminal]# ls -al richard2
total 76
drwxr-xr-x 4 root root 4096 Apr 4 15:01 ./
drwx------ 18 rrc rrc 4096 Apr 4 14:54 ../
-rw-r--r-- 1 root root 0 Apr 4 15:01 DelMe
-rw-r--r-- 1 root root 3320 Apr 4 14:54 evolution.es.html
-rw-r--r-- 1 root root 3272 Apr 4 14:54 evolution.html
drwxr-xr-x 2 root root 4096 Apr 4 14:54 images/
-rw-r--r-- 1 root root 14700 Apr 4 14:54 index.es.html
-rw-r--r-- 1 root root 13242 Apr 4 14:54 index.html
drwxr-xr-x 3 root root 4096 Apr 4 15:00 richard/
-rw-r--r-- 1 root root 4329 Apr 4 14:54 RichardSleeve.es.html
-rw-r--r-- 1 root root 4328 Apr 4 14:54 RichardSleeve.html
-rw-r--r-- 1 root root 489 Apr 4 14:54 robots.txt
[root@Llawyr ComandosDeLaTerminal]# touch /var/www/html/richard/DelMe2
[root@Llawyr ComandosDeLaTerminal]# cp -vu /var/www/html/richard/* richard2
‘/var/www/html/richard/DelMe2’ -> ‘richard2/DelMe2’
cp: omitting directory ‘/var/www/html/richard/images’
[root@Llawyr ComandosDeLaTerminal]# touch /var/www/html/richard/DelMe3
[root@Llawyr ComandosDeLaTerminal]# cp -vpu /var/www/html/richard/* richard2
‘/var/www/html/richard/DelMe3’ -> ‘richard2/DelMe3’
cp: omitting directory ‘/var/www/html/richard/images’
[root@Llawyr ComandosDeLaTerminal]# ls -al richard2
total 76
drwxr-xr-x 4 root root 4096 Apr 4 15:04 ./
drwx------ 18 rrc rrc 4096 Apr 4 14:54 ../
-rw-r--r-- 1 root root 0 Apr 4 15:01 DelMe
-rw-r--r-- 1 root root 0 Apr 4 15:03 DelMe2
-rw-r--r-- 1 root webmin 0 Apr 4 15:04 DelMe3
-rw-r--r-- 1 root root 3320 Apr 4 14:54 evolution.es.html
-rw-r--r-- 1 root root 3272 Apr 4 14:54 evolution.html
drwxr-xr-x 2 root root 4096 Apr 4 14:54 images/
-rw-r--r-- 1 root root 14700 Apr 4 14:54 index.es.html
-rw-r--r-- 1 root root 13242 Apr 4 14:54 index.html
drwxr-xr-x 3 root root 4096 Apr 4 15:00 richard/
-rw-r--r-- 1 root root 4329 Apr 4 14:54 RichardSleeve.es.html
-rw-r--r-- 1 root root 4328 Apr 4 14:54 RichardSleeve.html
-rw-r--r-- 1 root root 489 Apr 4 14:54 robots.txt
</syntaxhighlight>
[[Category:Comandos de la terminal]]