forktty(8)
forktty π
okay bestie, this is forktty(8) β yes, section 8, from the System Manager's Manual. she's a tiny little icon and she wants to attach a program to a CTTY. no cap. β¨
πΈ NAME πΈ
forktty β attach a program to a CTTY. periodt. π
π¦ SYNOPSIS π¦
forktty [-dhnpVvw] [-l /dev/tty??] [-c command] prog_to_run
β¨ DESCRIPTION β¨
forktty is a tiny little program that can be used to run a program in a new session. The program forks, redirects stdin to /dev/null β which returns the prompt β disconnects from the controlling terminal, optionally connects to a user-specified terminal, and runs a program. it's giving main character energy for background processes, fr fr. π
π OPTIONS π
-c commandβ executebash -c commandin the new session. π«Ά-dβ prepend a dash-to the program name passed in argument 0. used for login shells. π-fβ fork only, do not usesetsid()norNOCTTYto disconnect from the current CTTY.--fdi <int>,--fdo <int>,--fde <int>β copy stdin, stdout or stderr, into a file descriptor<int>usingdup2(2). Thus, a backgrounded program may interact via those new fd's. The values0,1,2are reserved and closed during the fork. π«Ά-hβ print a help message. π-l /dev/tty??β connect to terminal/dev/tty??;&<int>uses the file descriptor<int>. π¦-nβ don't initialize terminal. the tty is not set in raw-echomode. Seestty(1). πΈ-pβ pipe stdin and stdout to the terminal.-rβ useopen(NONBLOCK)stty()close()open()sequence. β¨--saneβ initialize the tty in VT style echo mode.-vβ enable verbose output. repeat to increase the verbosity. π₯-Vβ report version. π-wβ wait for child program termination before exit.
The program runs with stdin redirected to /dev/null if no new terminal is given. π
π EXAMPLES π
forktty --sane -l /dev/ttyS0 -- lynx -restriction=all
forktty -n -l /dev/ttyS0 -c 'reset && exec lynx -restrictions=all'
forktty -n -l /dev/ttyS0 -- bash -c 'reset && exec lynx
-restrictions=all'
forktty -c 'sleep 1; echo $0'
forktty -d -c 'sleep 1; echo $0'
forktty -d -- bash -c 'sleep 1; echo $0'
forktty -- bash -login -c 'sleep 1; echo $0'
π BUGS π
None known. literally none, bestie. not a single one. π
π¦ SEE ALSO π¦
fork(2), setsid(2) β go read them, iykyk. π¦
π source: System Manager's Manual Β· manual: forktty(8) Β· date: 28 Sep 2002 β mwah, bestie, go be iconic. π
π¦ where this page comes from
- nixos 26.05: forktty 1.3
- nixpkgs unstable: forktty 1.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms