Logging terminal

ターミナルのログを取得する

Command

script 

Example

myMacBook-ea $ script ./term-log/"`date +%Y%m%d-%H%M%S`"-"`whoami`".log
Script started, output file is ./term-log/20230826-145910-user1.log

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
$
$
$
$ls -la ./term-log/
total 24
drwxr-xr-x   5 user1  staff   160 Aug 26 14:59 .
drwxr-xr-x  22 user1  staff   704 Aug 26 14:43 ..
-rw-r--r--   1 user1  staff  1511 Aug 26 14:56 20230826-145602-user1.log
-rw-r--r--   1 user1  staff   789 Aug 26 14:57 20230826-145707-user1.log
-rw-r--r--   1 user1  staff    43 Aug 26 14:59 20230826-145910-user1.log
$

$
$exit
exit

Script done, output file is ./term-log/20230826-145910-user1.log
myMacBook-ea $ 

logfile

myMacBook-ea $ cat ./term-log/20230826-145910-user1.log 
Script started on Sat Aug 26 14:59:10 2023

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
$
$
$
$ls -la ./term-log/
total 24
drwxr-xr-x   5 user1  staff   160 Aug 26 14:59 .
drwxr-xr-x  22 user1  staff   704 Aug 26 14:43 ..
-rw-r--r--   1 user1  staff  1511 Aug 26 14:56 20230826-145602-user1.log
-rw-r--r--   1 user1  staff   789 Aug 26 14:57 20230826-145707-user1.log
-rw-r--r--   1 user1  staff    43 Aug 26 14:59 20230826-145910-user1.log
$
$
$exit
exit

Script done on Sat Aug 26 14:59:31 2023
myMacBook-ea $ 

Comments

Popular Posts