]> git.proxmox.com Git - ceph.git/blob - ceph/doc/cephfs/cephfs-shell.rst
import 15.2.0 Octopus source
[ceph.git] / ceph / doc / cephfs / cephfs-shell.rst
1
2 =============
3 CephFS Shell
4 =============
5
6 The File System (FS) shell includes various shell-like commands that directly interact with the :term:`Ceph File System`.
7
8 Usage :
9
10 cephfs-shell [-options] -- [command, command,...]
11
12 Options :
13 -c, --config FILE Set Configuration file.
14 -b, --batch FILE Process a batch file.
15 -t, --test FILE Test against transcript(s) in FILE
16
17
18 .. note::
19
20 Latest version of the cmd2 module is required for running cephfs-shell.
21 If CephFS is installed through source, execute cephfs-shell in the build
22 directory. It can also be executed as following using virtualenv:
23
24 .. code:: bash
25
26 [build]$ virtualenv -p python3 venv && source venv/bin/activate && pip3 install cmd2
27 [build]$ source vstart_environment.sh && source venv/bin/activate && python3 ../src/tools/cephfs/cephfs-shell
28
29 Commands
30 ========
31
32 mkdir
33 -----
34
35 Create the directory(ies), if they do not already exist.
36
37 Usage :
38
39 mkdir [-option] <directory>...
40
41 * directory - name of the directory to be created.
42
43 Options :
44 -m MODE Sets the access mode for the new directory.
45 -p, --parent Create parent directories as necessary. When this option is specified, no error is reported if a directory already exists.
46
47 put
48 ---
49
50 Copy a file/directory to Ceph File System from Local File System.
51
52 Usage :
53
54 put [options] <source_path> [target_path]
55
56 * source_path - local file/directory path to be copied to cephfs.
57 * if `.` copies all the file/directories in the local working directory.
58 * if `-` Reads the input from stdin.
59
60 * target_path - remote directory path where the files/directories are to be copied to.
61 * if `.` files/directories are copied to the remote working directory.
62
63 Options :
64 -f, --force Overwrites the destination if it already exists.
65
66
67 get
68 ---
69
70 Copy a file from Ceph File System to Local File System.
71
72 Usage :
73
74 get [options] <source_path> [target_path]
75
76 * source_path - remote file/directory path which is to be copied to local file system.
77 * if `.` copies all the file/directories in the remote working directory.
78
79 * target_path - local directory path where the files/directories are to be copied to.
80 * if `.` files/directories are copied to the local working directory.
81 * if `-` Writes output to stdout.
82
83 Options:
84 -f, --force Overwrites the destination if it already exists.
85
86 ls
87 --
88
89 List all the files and directories in the current working directory.
90
91 Usage :
92
93 ls [option] [directory]...
94
95 * directory - name of directory whose files/directories are to be listed.
96 * By default current working directory's files/directories are listed.
97
98 Options:
99 -l, --long list with long format - show permissions
100 -r, --reverse reverse sort
101 -H human readable
102 -a, -all ignore entries starting with .
103 -S Sort by file_size
104
105
106 cat
107 ---
108
109 Concatenate files and print on the standard output
110
111 Usage :
112
113 cat <file>....
114
115 * file - name of the file
116
117 cd
118 --
119
120 Change current working directory.
121
122 Usage :
123
124 cd [directory]
125
126 * directory - path/directory name. If no directory is mentioned it is changed to the root directory.
127 * If '.' moves to the parent directory of the current directory.
128
129 cwd
130 ---
131
132 Get current working directory.
133
134 Usage :
135
136 cwd
137
138
139 quit/Ctrl + D
140 -------------
141
142 Close the shell.
143
144 chmod
145 -----
146
147 Change the permissions of file/directory.
148
149 Usage :
150
151 chmod <mode> <file/directory>
152
153 mv
154 --
155
156 Moves files/Directory from source to destination.
157
158 Usage :
159
160 mv <source_path> <destination_path>
161
162 rmdir
163 -----
164
165 Delete a directory(ies).
166
167 Usage :
168
169 rmdir <directory_name>.....
170
171 rm
172 --
173
174 Remove a file(es).
175
176 Usage :
177
178 rm <file_name/pattern>...
179
180
181 write
182 -----
183
184 Create and Write a file.
185
186 Usage :
187
188 write <file_name>
189 <Enter Data>
190 Ctrl+D Exit.
191
192 lls
193 ---
194
195 Lists all files and directories in the specified directory.Current local directory files and directories are listed if no path is mentioned
196
197 Usage:
198
199 lls <path>.....
200
201 lcd
202 ---
203
204 Moves into the given local directory.
205
206 Usage :
207
208 lcd <path>
209
210 lpwd
211 ----
212
213 Prints the absolute path of the current local directory.
214
215 Usage :
216
217 lpwd
218
219
220 umask
221 -----
222
223 Set and get the file mode creation mask
224
225 Usage :
226
227 umask [mode]
228
229 alias
230 -----
231
232 Define or display aliases
233
234 Usage:
235
236 alias [name] | [<name> <value>]
237
238 * name - name of the alias being looked up, added, or replaced
239 * value - what the alias will be resolved to (if adding or replacing) this can contain spaces and does not need to be quoted
240
241 run_pyscript
242 ------------
243
244 Runs a python script file inside the console
245
246 Usage:
247
248 run_pyscript <script_path> [script_arguments]
249
250 * Console commands can be executed inside this script with cmd ("your command")
251 However, you cannot run nested "py" or "pyscript" commands from within this
252 script. Paths or arguments that contain spaces must be enclosed in quotes
253
254 .. note:: This command is available as ``pyscript`` for cmd2 versions 0.9.13
255 or less.
256
257 py
258 --
259
260 Invoke python command, shell, or script
261
262 Usage :
263
264 py <command>: Executes a Python command.
265 py: Enters interactive Python mode.
266
267 shortcuts
268 ---------
269
270 Lists shortcuts (aliases) available
271
272 Usage :
273
274 shortcuts
275
276 history
277 -------
278
279 View, run, edit, and save previously entered commands.
280
281 Usage :
282
283 history [-h] [-r | -e | -s | -o FILE | -t TRANSCRIPT] [arg]
284
285 Options:
286 -h show this help message and exit
287 -r run selected history items
288 -e edit and then run selected history items
289 -s script format; no separation lines
290 -o FILE output commands to a script file
291 -t TRANSCRIPT output commands and results to a transcript file
292
293 unalias
294 -------
295
296 Unsets aliases
297
298 Usage :
299
300 unalias [-a] name [name ...]
301
302 * name - name of the alias being unset
303
304 Options:
305 -a remove all alias definitions
306
307 set
308 ---
309
310 Sets a settable parameter or shows current settings of parameters.
311
312 Usage :
313
314 set [-h] [-a] [-l] [settable [settable ...]]
315
316 * Call without arguments for a list of settable parameters with their values.
317
318 Options :
319 -h show this help message and exit
320 -a display read-only settings as well
321 -l describe function of parameter
322
323 edit
324 ----
325
326 Edit a file in a text editor.
327
328 Usage:
329
330 edit [file_path]
331
332 * file_path - path to a file to open in editor
333
334 run_script
335 ----------
336
337 Runs commands in script file that is encoded as either ASCII or UTF-8 text.
338 Each command in the script should be separated by a newline.
339
340 Usage:
341
342 run_script <file_path>
343
344
345 * file_path - a file path pointing to a script
346
347 .. note:: This command is available as ``load`` for cmd2 versions 0.9.13
348 or less.
349
350 shell
351 -----
352
353 Execute a command as if at the OS prompt.
354
355 Usage:
356
357 shell <command> [arguments]
358
359 locate
360 ------
361
362 Find an item in File System
363
364 Usage:
365
366 locate [options] <name>
367
368 Options :
369 -c Count number of items found
370 -i Ignore case
371
372 stat
373 ------
374
375 Display file status.
376
377 Usage :
378
379 stat [-h] <file_name> [file_name ...]
380
381 Options :
382 -h Shows the help message
383
384 snap
385 ----
386
387 Create or Delete Snapshot
388
389 Usage:
390
391 snap {create|delete} <snap_name> <dir_name>
392
393 * snap_name - Snapshot name to be created or deleted
394
395 * dir_name - directory under which snapshot should be created or deleted
396
397 setxattr
398 --------
399
400 Set extended attribute for a file
401
402 Usage :
403
404 setxattr [-h] <path> <name> <value>
405
406 * path - Path to the file
407
408 * name - Extended attribute name to get or set
409
410 * value - Extended attribute value to be set
411
412 Options:
413 -h, --help Shows the help message
414
415 getxattr
416 --------
417
418 Get extended attribute value for the name associated with the path
419
420 Usage :
421
422 getxattr [-h] <path> <name>
423
424 * path - Path to the file
425
426 * name - Extended attribute name to get or set
427
428 Options:
429 -h, --help Shows the help message
430
431 listxattr
432 ---------
433
434 List extended attribute names associated with the path
435
436 Usage :
437
438 listxattr [-h] <path>
439
440 * path - Path to the file
441
442 Options:
443 -h, --help Shows the help message