script: command not found

The “script” command in Linux is used to record all the terminal input and output in a file. This can be very useful for keeping a record of your work, for sharing or reviewing later, or for debugging purposes.

To use the “script” command, simply open a terminal and type “script filename” where “filename” is the name of the file you want to save the output to. The script command will then start recording everything you type and all the output that appears on the terminal, until you stop it by typing “exit”.

If you encounter the below error while running the command script:

script: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install circos-tools
Ubuntu apt-get install circos-tools
Alpine apk add util-linux
Arch Linux pacman -S util-linux
Kali Linux apt-get install circos-tools
CentOS yum install util-linux
Fedora dnf install util-linux
OS X brew install util-linux
Raspbian apt-get install bsdutils

script Command Examples

1. Start recording in file named “typescript”:

# script

2. Stop recording:

# exit

3. Start recording in a given file:

# script logfile.log

4. Append to an existing file:

# script -a logfile.log

5. Execute quietly without start and done messages:

# script -q logfile.log

Note

Note that the “script” command can also be used with the “-a” option to append the output to an existing file, instead of overwriting it. Additionally, the “script” command can be used with the “-c” option to run a single command and record its output, without starting a new shell.

Related Post