Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
explain the meaning of the commands would be nice too...
Thnks!
The latter might work too, but ctrl+d is alot more intuitive and handy.. (: