In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces what script is in the Linux system, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
What is script? scirpt is a command that makes a record that is output to the terminal. This is useful for those who want to actually record terminal conversations. The record can be saved and printed later.
How to use by default, we can start the scirpt command by typing script in the terminal.
Pungki@dev-machine:~$ scriptScript started, file is typescriptpungki@dev-machine:~$ you can also specify the target file name to record the print result.
Pungki@dev-machine:~$ script myfile
Define script file
When you see the command prompt again, this means that the terminal will record anything printed to the terminal.
You will see the current directory, there is a file named myscript. (translated note by LCTT) the original text here is incorrect. The record file name is specified here as myfile instead of the default typescript. )
Why do we use the script command because as mentioned earlier, the main function of the script command is to record everything. Here are two scenarios that use this command.
When working with colleagues, we can record your activities through script when working with colleagues.
For example, we will use a print file called collaborate to complete the print:
$script collaborate
Create collaborate file
Then, after completing some tasks, if you need to send your work to another engineer, send him the file. So when another engineer needs to review what he has done, all he has to do is open the file with a text editor.
If he wants to update the file (to add to his work), he can use the-an option.
$script-a collaborate
Append the file
Record what someone is doing on the terminal. You may give your engineer or someone remote access to your system. To make sure your engineer is doing the right thing, you can record what he is doing on your system. To have the script command run automatically at login, we can add it to the shell environment configuration file. If you are using bash shell, add this line to your bash environment profile.
$vi ~ / .profile # run the script command to record everything# use-q for quite and-an option to append the script#/usr/bin/script-qa / usr/local/script/log_record_script
Add script to bash profile
And save it. The next time he logs in to your system, the script command will run automatically and log into / usr/local/script/log*record*script.
Script without notification
The-Q option allows the scirpt command to run in silent mode, and the logged-in user will not know that the script command has been run. The-an option will cause the record to be attached to the file without erasing the previous record.
If you do not use the-Q option, when the user logs in, he will receive a notification like the one shown below.
Script with notification
Exit record to exit the record activity, we can press Ctrl+D in the terminal or type exit. Before exiting script, you will find that the size of the record file is 0 Kb, but after exiting, the file size will change.
Thank you for reading this article carefully. I hope the article "what is script in Linux system" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.