• 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. How to uninstall rhythmbox-plugins from Ubuntu
  2. rc-service Command Examples in Linux
  3. caddy: An enterprise-ready open source web server with automatic HTTPS, written in Go
  4. How the BASH Shell load its configuration files in Linux
  5. How to setup passwordless SSH login in Linux
  6. How to Check Swap Usage Live via the ‘top’ Command in Linux
  7. grub-script-check Command Examples in Linux
  8. CentOS / RHEL : How to delete LVM volume
  9. atrm Command Examples in Linux
  10. What are sparse files in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples
  • “glab mr” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright