---
name: "TIOCCONS"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/TIOCCONS"
---

# TIOCCONS(2const)

redirecting console output

## NAME

TIOCCONS - redirecting console output

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#include <asm/termbits.h>  /* Definition of TIOCCONS */
#include <sys/ioctl.h>
```

**int ioctl(int** *fd***, TIOCCONS);**

## DESCRIPTION

Redirect output that would have gone to */dev/console* or */dev/tty0* to the given terminal. If that was a pseudoterminal master, send it to the slave.

Only a process with the **CAP\_SYS\_ADMIN** capability may do this.

If output was redirected already, then **EBUSY** is returned, but redirection can be stopped by using this ioctl with *fd* pointing at */dev/console* or */dev/tty0*.

## RETURN VALUE

On success, 0 is returned. On error, -1 is returned, and *errno* is set to indicate the error.

## ERRORS

- **EBUSY**

  Output was redirected already.

- **EPERM**

  Insufficient permission.

## HISTORY

Before Linux 2.6.10, anybody can do this as long as the output was not redirected yet; **CAP\_SYS\_ADMIN** was not necessary.

## SEE ALSO

[**ioctl**(2)](/ioctl/2.md), [**ioctl\_tty**(2)](/ioctl_tty/2.md)
