How To Use screen And script command In Linux
Linux Screen Command
Screen is a terminal multiplexer, using this you can run any number of cnsole-based-applications, interactive command shells, course-based applications, etc. You can use screen to keep running program after you accidentally close the terminal. Or even after you log out and later resume right where you were. You can start screen just by typing screen at command prompt. You will be greeted welcome message.
Example: 1
[root@localhost ~]# screen
This screen command will stat a new window within the screen.
Example: 2
[root@localhost ~]# screen-S aloft 1
Above command will start new window within the screen and also gives name of the window (aloft)
Example: 3
[root@localhost ~]# screen –ls
Above command displays crrent open screens, including those running in the background.
Example: 4
[root@localhost ~]# screen mc
The Midnight commander program will appear.
Example: 5
[root@localhost ~]# screen Top
The top program will start and displays output to the command line
Linux Script Command
This script command is very helpful for system admin. If any thing problem occurs to the system, its very difficult to find what command were executed previously. Hence System admin knows importance of this script command. Script command keeps action log for various tasks. Script records everything in a session: things you type and things you see. And also records color
Example: 1
[root@localhost ~]# script
Script started, file is typescript
By default, it writes to a file called typescript in the current directory. After completion of your task you can enter exit. This will close down the script session and save the file
Options
-a appends the output to file or typescript retaining their previous contents
Example: 2
[root@localhost ~]# script -a
Script started, file is typescript
-q run the script in the quite mode
Example: 3
[root@localhost ~]# script -q
Category: Linux Administration
