Sometime when you’re installing or configuring some tools, you might be interested in logging the details such as commands and it’s output. This can be easily done with
script command. This command helps you in making typescript of terminal session. Here is an example how you use this command-
$ script ~/installing-tree.log $ sudo apt-get install tree $ exit
script command basically you start the session, after that all the commands and output will be stored in the file passed as first argument. Once you’re done with your session, you can hit
exit command and session will be closed. And you can check the log file.
In case if you are not interested in keeping output but just the command, any time you can check
~/.bash_history file or you can hit
Are you worried that your password might be logged? Don’t worry it doesn’t log your password if you don’t pass directly in command line argument. :)