• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

script Command Examples in Linux

by Deepika

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”.

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.

Filed Under: Linux

Some more articles you might also be interested in …

  1. blight Command Examples in Linux
  2. doctum: A PHP API documentation generator
  3. wall: command not found
  4. “docker service” Command Examples
  5. slapt-get Command Examples in Linux
  6. pngcheck Command Examples in Linux
  7. join Command Examples
  8. pactl: command not found
  9. Understanding /etc/hosts file in Linux
  10. clear: Clears the screen of the terminal (Command Examples)

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright