Skip to content

Write

Writes the contents to a file on the remote machine.

distant fs write /path/to/file.txt 'hello world'

Flags

  • --append: indicates to append the contents to the file rather than overwrite it. If the file does not exist, it is created.

Examples

Piping content into a file

In the absence of a content positional argument, stdin will be read until EOF is received, and then used as the content for the file:

echo 'some text' | distant fs write /path/to/file.txt

Appending content to a file

If you provide the append flag, then all content is appended instead of overwriting the file:

distant fs write --append /path/to/file.txt 'some text'

Notes

  • If no contents are provided, then the contents are read from stdin.
  • Relative paths resolve to the current working directory of the server.
distant fs write --help
Writes the contents to a file on the remote machine

Usage: distant fs write [OPTIONS] <PATH> [DATA]

Arguments:
  <PATH>  The path to the file on the remote machine
  [DATA]  Data for server-side writing of content. If not provided, will read from stdin

Options:
      --cache <CACHE>                Location to store cached data [default: /home/runner/.cache/distant/cache.toml]
      --log-level <LOG_LEVEL>        Log level to use throughout the application [possible values: off, error, warn, info, debug, trace]
      --connection <CONNECTION>      Specify a connection being managed
      --log-file <LOG_FILE>          Path to file to use for logging
      --config <CONFIG_PATH>         Configuration file to load instead of the default paths
      --unix-socket <UNIX_SOCKET>    Override the path to the Unix socket used by the manager (unix-only)
      --windows-pipe <WINDOWS_PIPE>  Override the name of the local named Windows pipe used by the manager (windows-only)
      --append                       If specified, will append to a file versus overwriting it
  -h, --help                         Print help