Use the record tool (history, screen, script) in Linux

Source: Internet
Author: User

Generally, people only record some time and overhead at work, but not some processes. This article will introduce some record methods in Linux:

1. History/env

The most common record method is to save history to a file, so we can probably know how you operate it through this file.

History> session_cmd_record: Save your current history information

Alternatively, you can use HISTFILE = filenmae bash (bash-specific) to open a bash and save the record in a special file:

HISTFILE = session2.log bash put the log into another file

Setting HISTIGNORE to ignore unimportant commands is also useful, for example, ignoring unimportant commands like pwd and date.

Export HISTIGNORE = "ls: pwd: who" ignores irrelevant commands

Export HISTSIZE = 10000 set the maximum size of the history File

You also need to record and save some environment information in the project. Some people may not save the environment information, so you will no longer be able to know the original configuration after three years of viewing this program, thus it cannot run normally. In this case, it may take three weeks for the user to change the code to find out why the system cannot run normally. Therefore, it is important to record environment information.

For example, we can record this:

Env> env_record records your environment settings. Note: env does not record all environment variables.

Reference link:

Linux history commands

Linux history command details [graphic]

In Linux, use ctrl + r to quickly search for the history command.

Ii. screen

Screen can be viewed as the command line interface version of the window manager. It provides a unified interface for managing multiple sessions and corresponding functions. In the article "use Screen shared sessions", I introduced how to use screen to implement shared sessions. It is better to use Screen to share a terminal window with multiple computers. In Linux tips: use Screen to manage your remote sessions, there are some high-end applications of screen on window management.

However, this article introduces the record. screen is mentioned because it also has the record function. You can use Ctrl + H to enable or disable the record, or use Ctrl + h to record.

You can also use "screen-L" to record the entire session. After using the screen-L command, the listener will enter a record state, and all the work done in this state will be saved, until you exit with exit or Ctrl + D, the record will be saved in screenlog.0 by default (if screenlog.0 has been recorded, name it screenlog.1 ......). Screen-L is more effective for saving error messages or simply recording how to build programs.

Note: If you do not need to modify the screenlog.0 file under "screen-L", you will not be so smart.

For more details, please continue to read the highlights on the next page:

Common Screen commands in Linux

Zabbix sends Screen graphical reports by email

Linux virtual terminal command Screen usage

Linux tips: use Screen to manage your remote sessions

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.