cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

os:linux:command:script.html



Linux Commands#Process Management

How to use script command in Linux

Help/Manual

# script -h

Usage:
 script [options] [file]
 -f, --flush             run flush after each write
 -a, --append            append the output
 -q, --quiet             be quiet


Tips

How to delete escape sequence and color code

$ cat LOSG | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?m//g" | col > log.txt


Examples

$ script -afq /tmp/test.log

How to logging automatically

  • /etc/profile
  • ~/.bash_profile
LOGDIR=/var/log/script
script -afq ${LOGDIR}/$(whoami)_$(date +%Y%m%d_%H%M%S).log



os/linux/command/script.html.txt ยท Last modified: 2017/05/14 by admin

Page Tools