6 The File System (FS) shell includes various shell-like commands that directly interact with the :term:`Ceph File System`.
10 cephfs-shell [-options] -- [command, command,...]
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
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:
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
35 Create the directory(ies), if they do not already exist.
39 mkdir [-option] <directory>...
41 * directory - name of the directory to be created.
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.
50 Copy a file/directory to Ceph File System from Local File System.
54 put [options] <source_path> [target_path]
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.
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.
64 -f, --force Overwrites the destination if it already exists.
70 Copy a file from Ceph File System to Local File System.
74 get [options] <source_path> [target_path]
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.
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.
84 -f, --force Overwrites the destination if it already exists.
89 List all the files and directories in the current working directory.
93 ls [option] [directory]...
95 * directory - name of directory whose files/directories are to be listed.
96 * By default current working directory's files/directories are listed.
99 -l, --long list with long format - show permissions
100 -r, --reverse reverse sort
102 -a, -all ignore entries starting with .
109 Concatenate files and print on the standard output
115 * file - name of the file
120 Change current working directory.
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.
132 Get current working directory.
147 Change the permissions of file/directory.
151 chmod <mode> <file/directory>
156 Moves files/Directory from source to destination.
160 mv <source_path> <destination_path>
165 Delete a directory(ies).
169 rmdir <directory_name>.....
178 rm <file_name/pattern>...
184 Create and Write a file.
195 Lists all files and directories in the specified directory.Current local directory files and directories are listed if no path is mentioned
204 Moves into the given local directory.
213 Prints the absolute path of the current local directory.
223 Set and get the file mode creation mask
232 Define or display aliases
236 alias [name] | [<name> <value>]
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
244 Runs a python script file inside the console
248 run_pyscript <script_path> [script_arguments]
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
254 .. note:: This command is available as ``pyscript`` for cmd2 versions 0.9.13
260 Invoke python command, shell, or script
264 py <command>: Executes a Python command.
265 py: Enters interactive Python mode.
270 Lists shortcuts (aliases) available
279 View, run, edit, and save previously entered commands.
283 history [-h] [-r | -e | -s | -o FILE | -t TRANSCRIPT] [arg]
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
300 unalias [-a] name [name ...]
302 * name - name of the alias being unset
305 -a remove all alias definitions
310 Sets a settable parameter or shows current settings of parameters.
314 set [-h] [-a] [-l] [settable [settable ...]]
316 * Call without arguments for a list of settable parameters with their values.
319 -h show this help message and exit
320 -a display read-only settings as well
321 -l describe function of parameter
326 Edit a file in a text editor.
332 * file_path - path to a file to open in editor
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.
342 run_script <file_path>
345 * file_path - a file path pointing to a script
347 .. note:: This command is available as ``load`` for cmd2 versions 0.9.13
353 Execute a command as if at the OS prompt.
357 shell <command> [arguments]
362 Find an item in File System
366 locate [options] <name>
369 -c Count number of items found
379 stat [-h] <file_name> [file_name ...]
382 -h Shows the help message
387 Create or Delete Snapshot
391 snap {create|delete} <snap_name> <dir_name>
393 * snap_name - Snapshot name to be created or deleted
395 * dir_name - directory under which snapshot should be created or deleted
400 Set extended attribute for a file
404 setxattr [-h] <path> <name> <value>
406 * path - Path to the file
408 * name - Extended attribute name to get or set
410 * value - Extended attribute value to be set
413 -h, --help Shows the help message
418 Get extended attribute value for the name associated with the path
422 getxattr [-h] <path> <name>
424 * path - Path to the file
426 * name - Extended attribute name to get or set
429 -h, --help Shows the help message
434 List extended attribute names associated with the path
438 listxattr [-h] <path>
440 * path - Path to the file
443 -h, --help Shows the help message