CEPHFS-SHELL(8) Ceph CEPHFS-SHELL(8)

# [NAME](#NAME)

cephfs-shell - Shell-like tool talking with CephFS

# [SYNOPSIS](#SYNOPSIS)

```
cephfs-shell [options] [command]
cephfs-shell [options] -- [command, command,...]
```

# [DESCRIPTION](#DESCRIPTION)

CephFS Shell provides shell-like commands that directly interact with the Ceph File System.

This tool can be used in interactive mode as well as in non-interactive mode. In former mode, cephfs-shell opens a shell session and after the given command is finished, it prints the prompt string and waits indefinitely. When the shell session is finished, cephfs-shell quits with the return value of last executed command. In non-interactive mode, cephfs-shell issues a command and exits right after the command's execution is complete with the command's return value.

Behaviour of CephFS Shell can be tweaked using **cephfs-shell.conf**. Refer to CephFS Shell Configuration File for details.

# [OPTIONS](#OPTIONS)

[**-b, --batch FILE**](#b,)

Path to batch file.

[**-c, --config FILE**](#c,)

Path to cephfs-shell.conf

[**-f, --fs FS**](#f,)

Name of filesystem to mount.

[**-t, --test FILE**](#t,)

Path to transcript(s) in FILE for testing

**Note:**

Latest version of the cmd2 module is required for running cephfs-shell. If CephFS is installed through source, execute cephfs-shell in the build directory. It can also be executed as following using virtualenv:

```
[build]$ python3 -m venv venv && source venv/bin/activate && pip3 install cmd2 colorama
[build]$ source vstart_environment.sh && source venv/bin/activate && python3 ../src/tools/cephfs/shell/cephfs-shell
```

# [COMMANDS](#COMMANDS)

**Note:**

Apart from Ceph File System, CephFS Shell commands can also interact directly with the local file system. To achieve this, **!** (an exclamation point) must precede the CephFS Shell command.

Usage :

!&lt;cephfs\_shell\_command&gt;

For example,

```
CephFS:~/>>> !ls # Lists the local file system directory contents.
CephFS:~/>>> ls  # Lists the Ceph File System directory contents.
```

## [mkdir](#mkdir)

Create the directory(ies), if they do not already exist.

Usage :

mkdir \[-option] &lt;directory&gt;...

•

directory - name of the directory to be created.

[**Options :**](#Options)

[**-m MODE**](#m)

Sets the access mode for the new directory.

[**-p, --parent**](#p)

Create parent directories as necessary. When this option is specified, no error is reported if a directory already exists.

## [put](#put)

Copy a file/directory to Ceph File System from Local File System.

Usage :

put \[options] &lt;source\_path&gt; &lt;target\_path&gt;

•

[**source\_path - local file/directory path to be copied to cephfs.**](#source_path)

- if *.* copies all the file/directories in the local working directory.
- if *-* Reads the input from stdin.

•

[**target\_path - remote directory path where the files/directories are to be copied to.**](#target_path)

•

if *.* files/directories are copied to the remote working directory.

[**Options :**](#Options~2)

[**-f*,* --force**](#f)

Overwrites the destination if it already exists.

## [get](#get)

Copy a file from Ceph File System to Local File System.

Usage :

get \[options] &lt;source\_path&gt; &lt;target\_path&gt;

•

[**source\_path - remote file/directory path which is to be copied to local file system.**](#source_path~2)

•

if *.* copies all the file/directories in the remote working directory.

•

[**target\_path - local directory path where the files/directories are to be copied to.**](#target_path~2)

- if *.* files/directories are copied to the local working directory.
- if *-* Writes output to stdout.

[**Options:**](#Options:)

[**-f*,* --force**](#f~2)

Overwrites the destination if it already exists.

## [ls](#ls)

List all the files and directories in the current working directory.

Usage :

ls \[option] \[directory]...

•

[**directory - name of directory whose files/directories are to be listed.**](#directory)

•

By default current working directory's files/directories are listed.

[**Options:**](#Options:~2)

**-l, --long**

list with long format - show permissions

**-r, --reverse**

reverse sort

[**-H**](#H)

human readable

**-a,**-a**ll**

ignore entries starting with .

[**-S**](#S)

Sort by file\_size

## [cat](#cat)

Concatenate files and print on the standard output

Usage :

cat &lt;file&gt;....

•

file - name of the file

## [ln](#ln)

Add a hard link to an existing file or create a symbolic link to an existing file or directory.

Usage:

ln \[options] &lt;target&gt; \[link\_name]

- target - file/directory to which a link is to be created
- link\_name - link to target with the name link\_name

[**Options:**](#Options:~3)

**-s, --symbolic**

Create symbolic link

[**-v, --verbose**](#v)

Print name of each linked file

[**-f, --force**](#f~3)

Force create link/symbolic link

## [cd](#cd)

Change current working directory.

Usage :

cd \[directory]

•

[**directory - path/directory name. If no directory is mentioned it is changed to the root directory.**](#directory~2)

•

If '.' moves to the parent directory of the current directory.

## [cwd](#cwd)

Get current working directory.

Usage :

cwd

## [quit/Ctrl + D](#quit/Ctrl_+_D)

Close the shell.

## [chmod](#chmod)

Change the permissions of file/directory.

Usage :

chmod &lt;mode&gt; &lt;file/directory&gt;

## [mv](#mv)

Moves files/Directory from source to destination.

Usage :

mv &lt;source\_path&gt; &lt;destination\_path&gt;

## [rmdir](#rmdir)

Delete a directory(ies).

Usage :

rmdir &lt;directory\_name&gt;.....

## [rm](#rm)

Remove a file(es).

Usage :

rm &lt;file\_name/pattern&gt;...

## [write](#write)

Create and Write a file.

Usage :

write &lt;file\_name&gt; &lt;Enter Data&gt; Ctrl+D Exit.

## [lls](#lls)

Lists all files and directories in the specified directory.Current local directory files and directories are listed if no path is mentioned

Usage:

lls &lt;path&gt;.....

## [lcd](#lcd)

Moves into the given local directory.

Usage :

lcd &lt;path&gt;

## [lpwd](#lpwd)

Prints the absolute path of the current local directory.

Usage :

lpwd

## [umask](#umask)

Set and get the file mode creation mask

Usage :

umask \[mode]

## [alias](#alias)

Define or display aliases

Usage:

alias \[name] | \[&lt;name&gt; &lt;value&gt;]

- name - name of the alias being looked up, added, or replaced
- value - what the alias will be resolved to (if adding or replacing) this can contain spaces and does not need to be quoted

## [run\_pyscript](#run_pyscript)

Runs a python script file inside the console

Usage:

run\_pyscript &lt;script\_path&gt; \[script\_arguments]

•

Console commands can be executed inside this script with cmd ("your command") However, you cannot run nested "py" or "pyscript" commands from within this script. Paths or arguments that contain spaces must be enclosed in quotes

**Note:**

This command is available as **pyscript** for cmd2 versions 0.9.13 or less.

## [py](#py)

Invoke python command, shell, or script

Usage :

py &lt;command&gt;: Executes a Python command. py: Enters interactive Python mode.

## [shortcuts](#shortcuts)

Lists shortcuts (aliases) available

Usage :

shortcuts

## [history](#history)

View, run, edit, and save previously entered commands.

Usage :

history \[-h] \[-r | -e | -s | -o FILE | -t TRANSCRIPT] \[arg]

[**Options:**](#Options:~4)

[**-h**](#h)

show this help message and exit

[**-r**](#r)

run selected history items

[**-e**](#e)

edit and then run selected history items

[**-s**](#s)

script format; no separation lines

[**-o FILE**](#o)

output commands to a script file

[**-t TRANSCRIPT**](#t)

output commands and results to a transcript file

## [unalias](#unalias)

Unsets aliases

Usage :

unalias \[-a] name \[name ...]

•

name - name of the alias being unset

[**Options:**](#Options:~5)

[**-a**](#a)

remove all alias definitions

## [set](#set)

Sets a settable parameter or shows current settings of parameters.

Usage :

set \[-h] \[-a] \[-l] \[settable \[settable ...]]

•

Call without arguments for a list of settable parameters with their values.

[**Options :**](#Options~3)

[**-h**](#h~2)

show this help message and exit

[**-a**](#a~2)

display read-only settings as well

[**-l**](#l)

describe function of parameter

## [edit](#edit)

Edit a file in a text editor.

Usage:

edit \[file\_path]

•

file\_path - path to a file to open in editor

## [run\_script](#run_script)

Runs commands in script file that is encoded as either ASCII or UTF-8 text. Each command in the script should be separated by a newline.

Usage:

run\_script &lt;file\_path&gt;

•

file\_path - a file path pointing to a script

**Note:**

This command is available as **load** for cmd2 versions 0.9.13 or less.

## [shell](#shell)

Execute a command as if at the OS prompt.

Usage:

shell &lt;command&gt; \[arguments]

## [locate](#locate)

Find an item in File System

Usage:

locate \[options] &lt;name&gt;

[**Options :**](#Options~4)

[**-c**](#c)

Count number of items found

[**-i**](#i)

Ignore case

## [stat](#stat)

Display file status.

Usage :

stat \[-h] &lt;file\_name&gt; \[file\_name ...]

[**Options :**](#Options~5)

[**-h**](#h~3)

Shows the help message

## [snap](#snap)

Create or Delete Snapshot

Usage:

snap {create|delete} &lt;snap\_name&gt; &lt;dir\_name&gt;

- snap\_name - Snapshot name to be created or deleted
- dir\_name - directory under which snapshot should be created or deleted

## [setxattr](#setxattr)

Set extended attribute for a file

Usage :

setxattr \[-h] &lt;path&gt; &lt;name&gt; &lt;value&gt;

- path - Path to the file
- name - Extended attribute name to get or set
- value - Extended attribute value to be set

[**Options:**](#Options:~6)

**-h, --help**

Shows the help message

## [getxattr](#getxattr)

Get extended attribute value for the name associated with the path

Usage :

getxattr \[-h] &lt;path&gt; &lt;name&gt;

- path - Path to the file
- name - Extended attribute name to get or set

[**Options:**](#Options:~7)

**-h, --help**

Shows the help message

## [listxattr](#listxattr)

List extended attribute names associated with the path

Usage :

listxattr \[-h] &lt;path&gt;

•

path - Path to the file

[**Options:**](#Options:~8)

**-h, --help**

Shows the help message

## [df](#df)

Display amount of available disk space

Usage :

df \[-h] \[file \[file ...]]

•

file - name of the file

[**Options:**](#Options:~9)

**-h, --help**

Shows the help message

## [du](#du)

Show disk usage of a directory

Usage :

du \[-h] \[-r] \[paths \[paths ...]]

•

paths - name of the directory

[**Options:**](#Options:~10)

**-h, --help**

Shows the help message

[**-r**](#r~2)

Recursive Disk usage of all directories

## [quota](#quota)

Quota management for a Directory

Usage :

quota \[-h] \[--max\_bytes \[MAX\_BYTES]] \[--max\_files \[MAX\_FILES]] {get,set} path

- {get,set} - quota operation type.
- path - name of the directory.

[**Options :**](#Options~6)

**-h, --help**

Shows the help message

[**--max\_bytes MAX\_BYTES**](#max_bytes)

Set max cumulative size of the data under this directory

[**--max\_files MAX\_FILES**](#max_files)

Set total number of files under this directory tree

# [CEPHFS SHELL CONFIGURATION FILE](#CEPHFS_SHELL_CONFIGURATION_FILE)

By default, CephFS Shell looks for **cephfs-shell.conf** in the path provided by the environment variable **CEPHFS\_SHELL\_CONF** and then in user's home directory (**~/.cephfs-shell.conf**).

Right now, CephFS Shell inherits all its options from its dependency **cmd2**. Therefore, these options might vary with the version of **cmd2** installed on your system. Refer to **cmd2** docs for a description of these options.

Following is a sample **cephfs-shell.conf**

```
[cephfs-shell]
prompt = CephFS:~/>>>
continuation_prompt = >
quiet = False
timing = False
colors = True
debug = False
abbrev = False
autorun_on_edit = False
echo = False
editor = vim
feedback_to_output = False
locals_in_py = True
```

# [EXIT CODE](#EXIT_CODE)

Following exit codes are returned by cephfs shell

Error Type Exit Code Miscellaneous 1 Keyboard Interrupt 2 Operation not permitted 3 Permission denied 4 No such file or directory 5 I/O error 6 No space left on device 7 File exists 8 No data available 9 Invalid argument 10 Operation not supported on transport endpoint 11 Range error 12 Operation would block 13 Directory not empty 14 Not a directory 15 Disk quota exceeded 16 Broken pipe 17 Cannot send after transport endpoint shutdown 18 Connection aborted 19 Connection refused 20 Connection reset 21 Interrupted function call 22

# [FILES](#FILES)

**~/.cephfs-shell.conf**

# [Copyright](#Copyright)

2010-2014, Inktank Storage, Inc. and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0)

October 9, 2026 dev

---

Document: cephfs-shell(8) from ceph-fips-19 19.2.7-r0 (Chainguard OS)
Source: https://github.com/ceph/ceph.git
