# server.Server.sourceFile

- **Module:** server
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/server.ts#L1384
- **Page:** https://libtmux.org/en/ts/latest/reference/server-server-sourcefile/

```
sourceFile(path: string): Promise<void>
```

Run a tmux config file against this server.

tmux does not expand `~` here. [`source-file`](/en/tmux/latest/manual/source-file/) joins a path that is not
absolute to the client's working directory and globs the result, so
`"~/.tmux.conf"` looks for a directory literally named `~`. Typing it at a
shell works because the shell expands it first; passing it as a string
never does.

## Examples

```ts
await server.sourceFile(`${process.env["HOME"] ?? "."}/.tmux.conf`);
```

## Parameters

- `path` (`string`)

## tmux command

The tmux commands behind `sourceFile`.

- [`source-file`](/en/tmux/latest/manual/source-file/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_source_file_entry`](/en/tmux/latest/reference/c-variable-cmd_source_file_entry/) (attribute)
- [`cmd_source_file_exec`](/en/tmux/latest/reference/c-function-cmd-source-file-c-cmd_source_file_exec/) (function)

## In other ports

Load a tmux configuration file

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Server.source_file`](/en/py/latest/reference/libtmux-server-source_file/) (method) |
| Ruby | [`LibTmux::Server#source_file`](/en/ruby/latest/reference/libtmux-server-source_file/) (method) |
| Rust | [`server.Server.source_file`](/en/rs/latest/reference/server-server-source_file/) (method) |
| Go | [`tmux.Server.SourceFile`](/en/go/latest/reference/tmux-server-sourcefile/) (method) |
| Java | [`io.github.libtmux.Server.sourceFile`](/en/java/latest/reference/io-github-libtmux-server-server-sourcefile/) (method) |
| C# | [`LibTmux.Server.SourceFileAsync`](/en/csharp/latest/reference/libtmux-server-sourcefileasync/) (method) |
| C++ | [`libtmux::Server::source_file`](/en/cxx/latest/reference/libtmux-server-source_file/) (method) |
| Swift | [`Server.sourceFile(_:)`](/en/swift/latest/reference/server-sourcefile(_-)/) (method) |

No equivalent is recorded in Lua, PowerShell, Julia, Elixir, Kotlin, Scala or F#.
