LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices

By keefaz at 2005-03-05 10:52
There are two tools that can be usefull when working in console :
- script
- screen

1. script

script is a nice program that let you monitor in one or
more terminals what you type in another terminal.

Example:
- Open two X terminals in your X session or use the Linux
ttys (ctrl + alt + F1-6)

- On one terminal, type :
Code:
cd ~
mkfifo output
script -f output
- On another terminal (or more), type :
Code:
cd ~
cat output
- Then return to the first terminal and execute any
command you like (ls, cd, ping...)

The output should be appear on every terminals where
you cat output fifo.

- Exit script session by typing exit command in the first
terminal (the one which you started script command)

man script for more infos


2. screen

screen is a terminal screen manager (like a window manager
but for consoles)

Example:
- In a terminal, type : screen
screen is now started, it has opened one screen, you should
see the prompt of your shell, waiting for commands

- Name this screen with typing : [ctrl + a], then A (note that
A is uppercase, so you may need to type:
[ctrl +a], then [shift +a]
Erase the default title using backspace key and name it whith
any name you want, say "Shell 1", press <enter> key.

- Create a new screen with : [ctrl + a] [ctrl + c], name it
([ctrl + a], [shift + a]), say "Shell 2"

- To switch between these 2 screens, type [ctrl + a], then ["]
(double quote key), you should see a list of all your screens
To enter on one, just select it with the top/bottom arrow keys
and press <enter>

- To exit screen, just type exit in all your opened screens

Tips for ssh session :
Say you run a command that take long time to complete
(say updatedb or a system upgrade), you can detach your
screen, exit ssh session, let the command run on the
remote host and return to the screen later :

- ssh to your remote host, run screen, run your command,
then type : [ctrl + a], [shift + d], [shift + d]

You now are now logout of your ssh session, screen in
remote host is detached so it keep running your command

To return to your screen, ssh into your remote host, then
use : screen -r

You are now in the screen showing output of the command
you issued before.

man screen for more infos

by bdox on Mon, 2005-03-21 09:45
I read the article and I still when and how those programs can be useful...
explain the meaning of the commands would be nice too...
Thnks!

by Artanicus on Wed, 2005-06-15 03:35
um, isnt it ctrl+a ctrl+d to detach a screen, not ctrl+a shift+d shift+d ?
The latter might work too, but ctrl+d is alot more intuitive and handy.. (:


  



All times are GMT -5. The time now is 05:34 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration