---
name: "xcwd"
section: "1"
platform: "linux"
package: "xcwd"
version: "0~2.gbpe2c777c-1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/xcwd"
---

# xcwd(1)

X current working directory

## NAME

xcwd - X current working directory

## SYNOPSIS

**xcwd**

## DESCRIPTION

**xcwd** is a simple tool which prints the current working directory of the focused window. It's useful for launching applications directly into the same directory as the focused application—for instance, you might want to launch a new terminal in the same directory as your editor. You can make this happen by binding something like

```
urxvt -cd "$(xcwd)"
```

to a keyboard shortcut within your window manager and then invoking that shortcut during editor usage.

## EXIT STATUS

**xcwd** exits with a nonzero status if it can't figure out the working directory associated with the currently focused window and $HOME is unset. Otherwise, **xcwd** returns zero.

## ENVIRONMENT

If **xcwd** can't figure out the working directory associated with the currently focused window, it falls back on $HOME.

## BUGS

**xcwd**'s algorithm fails when applied to most single-instance applications, applications with tabs, or terminal multiplexers. [**lilyterm**(1)](/lilyterm/1.md), [**screen**(1)](/screen/1.md), [**tmux**(1)](/tmux/1.md), and [**urxvtc**(1)](/urxvtc/1.md) are all known to fail.

## SEE ALSO

[**gnome-terminal**(1)](/gnome-terminal/1.md), [**terminology**(1)](/terminology/1.md), [**urxvt**(1)](/urxvt/1.md), [**xterm**(1)](/xterm/1.md)

## COPYRIGHT

**xcwd** is copyright 2013 Adrien Schildknecht ⟨adrien+dev@schischi.me⟩.

This manual page is copyright 2013, 2015–2018 Benjamin Barenblat and licensed under the Apache License, Version 2.0.
