SCRIPT(1)
๐ SCRIPT(1) โ or, how to record literally everything your terminal does ๐
okay bestie, welcome to script(1) from the User Commands corner of the manual. she's a little chaotic, she's a little powerful, and she's about to make a full-on movie of your terminal session. no cap. ๐ฌโจ
โจ NAME โจ
script โ make a typescript of your terminal session. like, the whole thing. every keystroke, every glow-up, every typo. ๐
๐ธ SYNOPSIS ๐ธ
script [options] [file] [-- command [argument...]]
that's it. that's the whole vibe. options, maybe a file, maybe a command after the --. periodt. ๐
๐ฆ DESCRIPTION ๐ฆ
so script makes a typescript of everything that happens on your terminal session. not a summary, not a highlight reel โ everything. ๐ญ
the terminal data gets stored in raw form in the log file, and the info about timing goes into a different, optional, structured log file. that timing log file is not just decoration, bestie โ you need it if you wanna replay the session later with scriptreplay(1), and it's also where extra session info gets stashed. ๐ซถ
since version 2.35, script supports multiple streams and lets you log input and output to separate files or all in one file. iconic behavior honestly. this version also has a new timing file that records additional information โ and then scriptreplay --summary serves you the whole tea. โโจ
if you pass the argument file, or you use the option --log-out file, then script saves the dialogue into that file. if you give her no filename at all, the dialogue lands in a file called typescript. that's just her default name, she's not being mysterious. ๐
โ ๏ธ real talk, listen up: logging input with--log-inor--log-iocan record security-sensitive information, because the log file will contain all terminal session input โ yes, including passwords โ and it does not care whether the terminal echo flag is on or off. it logs it anyway. be careful, bestie. fr fr. ๐
๐ OPTIONS ๐
first, a lil public service announcement about sizes, because it applies below:
the size argument may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB โ and the "iB" part is optional, so for example "K" means exactly the same thing as "KiB". โจ or you can go with the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB. yes the 1000 vs 1024 thing is real and yes you should care. ๐
-a,--appendโ append the output to file or totypescript, and keep all the prior contents. nothing gets deleted, nothing gets overwritten, she just keeps adding. ๐ง-c,--commandcommand โ run command instead of an interactive shell. this is lowkey the move when a script needs to capture the output of a program that acts different when its stdout isn't a tty. and heads up: instead of using the option-c, you can also just put the command after a double dash (--). same energy. ๐ซถ-E,--echowhen โ this one controls theECHOflag for the slave end of the session's pseudoterminal. the supported modes arealways,never, orauto. ๐- the default is
autoโ in that case,ECHOis enabled for the pseudoterminal slave; if the current standard input is a terminal,ECHOgets disabled for it so you don't get double echo; and if the current standard input is not a terminal (for examplepipe: echo date | script) then keepingECHOenabled for the pseudoterminal slave means the standard input data can be viewed on screen while it's being recorded to the session log at the same time. multitasking queen. โจ - and ngl,
'never'mode does affect the content of the session output log, because the user's input is not repeated on the output. so like. just know that. ๐ญ
- the default is
-e,--returnโ return the exit status of the child process. it uses the same format as bash termination on signal termination (i.e., exit status is128+ the signal number). and btw the exit status of the child process is always stored in the type script file too. so you get it either way. ๐-f,--flushโ flush output after every single write. this is chef's kiss for telecooperation: one person runsmkfifo foo; script -f foo, and another person can supervise in real-time what's being done usingcat foo. adorable. but also โ flush has an impact on performance, so don't forget that. good news though: it's possible to useSIGUSR1to flush logs on demand. ๐ฅ--forceโ allow the default output filetypescriptto be a hard or symbolic link. and yes, the command will follow a symbolic link. ๐ฆ-B,--log-iofile โ log input and output to the same file. but listen: this option only makes sense if--log-timingis also specified, otherwise it's literally impossible to separate the output and input streams from the log file. iykyk. ๐-I,--log-infile โ log input to file. and just so you know, the log output gets disabled if only--log-inis specified. ๐- > use this logging functionality carefully, bestie, because it logs all input, including input from when the terminal has the echo flag disabled โ you know, like password inputs. ๐
-O,--log-outfile โ log output to file. the default is to log output to the file namedtypescriptif neither the option--log-outnor--log-inis given. and the log output gets disabled if only--log-inis specified. (yeah, same rule as above, they're besties.) ๐-T,--log-timingfile โ log timing information to file. there are two timing file formats supported right now: the classic format is used when only one stream (input or output) logging is enabled, and the multi-stream format is used on--log-ioor when--log-inand--log-outare used together. see also--logging-format. โจ-m,--logging-formatformat โ force use of the advanced or classic timing log format. the default is the classic format to log only output, and the advanced format when input as well as output logging is requested. ๐- Classic format
- the timing log contains two fields, separated by a space. the first field indicates how much time elapsed since the previous output. the second field indicates how many characters were output this time. simple. clean. cute.
- Advanced (multi-stream) format
- the first field is an entry type identifier (
'I'nput,'O'utput,'H'eader,'S'ignal). the second field is how much time elapsed since the previous entry, and the rest of the entry is type-specific data. ๐
- the first field is an entry type identifier (
- Classic format
-o,--output-limitsize โ limit the size of the typescript and timing files to size, and stop the child process after this size is exceeded. important detail: the calculated file size does not include the start and done messages that thescriptcommand prepends and appends to the child process output. and because of buffering, the resulting output file might actually be larger than the value you specified. she tried her best. ๐ญ-q,--quietโ be quiet, bestie. meaning: do not write start and done messages to standard output. ๐คซ-t[file],--timing[=file]โ output timing data to standard error, or to file when given. โ ๏ธ this option is deprecated in favour of--log-timing, where the file argument is not optional. she's retired, let her rest. ๐-h,--helpโ display help text and exit. the classic. ๐ซถ-V,--versionโ display version and exit. also the classic. โญ
๐ SIGNALS ๐
upon receiving SIGUSR1, script immediately flushes the output files. that's it. that's the whole section. she heard you. ๐
๐ง ENVIRONMENT ๐ง
the following environment variable is utilized by script:
SHELLโ if the variableSHELLexists, the shell forked byscriptwill be that shell. ifSHELLis not set, the Bourne shell is assumed. (and most shells set this variable automatically, so like, no stress.) ๐
๐ NOTES ๐
- the script ends when the forked shell exits โ that's a control-D for the Bourne shell (
sh(1p)), andexit,logoutor control-d (ifignoreeofis not set) for the C-shell,csh(1). ๐ - certain interactive commands, such as
vi(1), create garbage in the typescript file. ๐ญscriptworks best with commands that do not manipulate the screen โ the results are meant to emulate a hardcopy terminal. vintage vibes only. ๐จ๏ธ - it is not recommended to run
scriptin non-interactive shells. the inner shell ofscriptis always interactive, and this could lead to unexpected results. and if you usescriptin the shell initialization file, you have to avoid entering an infinite loop. you can use, for example, the.profilefile, which is read by login shells only:
if test -t 0 ; then
script
exit
fi
- you should also avoid use of
scriptin command pipes, becausescriptcan read more input than you would expect. she's greedy like that. ๐
โญ HISTORY โญ
the script command appeared in 3.0BSD. she's an elder, respect her. ๐
๐ BUGS ๐
scriptplaces everything in the log file, including linefeeds and backspaces. this is not what the naive user expects. surprise! ๐scriptis primarily designed for interactive terminal sessions. when stdin is not a terminal (for example:echo foo | script), then the session can hang, because the interactive shell within thescriptsession missesEOFandscripthas no clue when to close the session. see the NOTES section for more information. ๐
๐ซถ SEE ALSO ๐ซถ
csh(1) (for the history mechanism), scriptreplay(1), scriptlive(1)
๐ REPORTING BUGS ๐
for bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>.
๐ธ AVAILABILITY ๐ธ
the script command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.
and that's the whole page, bestie!! ๐ this lil masterpiece is brought to you by util-linux version 2.42.4, dated 2026-09-21, and it's the SCRIPT(1) page โ go forth and record your terminal like the main character you are. ๐โจ๐๐ฆ๐
๐ฆ where this page comes from
- arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms