Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO(small):screen, the app
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
AssociateX
Tux's lil' helper
Tux's lil' helper


Joined: 19 Feb 2004
Posts: 134
Location: North Dakota

PostPosted: Sun Feb 18, 2007 5:40 pm    Post subject: HOWTO(small):screen, the app Reply with quote

TO START SPLIT SESSION

Open a terminal and run the following command:
Code:
screen

Then do the following key combinations:
"ctrl a" then "shift s" <---- Creates the split.
"ctrl a" then "tab" <---- Changes the focus to other region.
"ctrl a" then "ctrl c" <---- Starts new shell in new region.

TO NAVIGATE SPLIT SESSION

"ctrl a" then "tab" <---- Changes the focus to other region.
"ctrl a" then "spacebar" <---- Switches the regions session to other running sessions.

RUNNING APPS EXAMPLE 1

Navigate to the screen region that you want to run your app from then run the following command:
Code:
top

"ctrl a" then "tab" <---- Changes the focus to other region.
Code:
su -
enter password then
Code:
emerge -ep world

Now you can see that "top" shows "emerge" using 75% of your cpu.

RUNNING APPS EXAMPLE 2

Of course you could also use an editor in one region to edit a conf file and in the other region stop and start the process to see how the change has taken place.

Code:
vi /etc/conf.d/clock
then change the CLOCK="local" to "UTC" or visa versa, save/write to file but don't close the editor and file.

"ctrl a" then "tab" <---- Changes the focus to other region.
Code:
/etc/init.d/clock restart
now you can see the time get's all screwed up so...

"ctrl a" then "tab" <---- Changes the focus to other region.
Code:
vi /etc/conf.d/clock
change back to "UTC" or "local" then save to file again

"ctrl a" then "tab" <---- Changes the focus to other region.
Code:
/etc/init.d/clock restart
now you can see the time is back to what it was before this example.

*********************************************************************************************

TO USE SCREEN WITH ssh FOR TWO USERS

I'm using this example for a LAN but it works just as well over the net.

Remote computer 192.168.0.1 <---- Needs help.
From this computer run the following:
Code:
screen


Local computer 192.168.0.2 <---- Smart person offering help.
From this computer run the following:
Code:
ssh [user@]192.168.0.1
then password <---- Use a regular account not root.
Then run:
Code:
screen -x
Now both users(Local and Remote) can see and have control over the prompt and what ever is typed to it.

Remote computer 192.168.0.1 <---- Needs help.
Code:
su -
then password <---- This allows the Remote user to give root level access without giving out the password for root. This is not a catchall for safety though.

SCREEN CHAT OPTION

Local <---- Smart person offering help.

"ctrl a" then "shift s" <---- Creates the split.
"ctrl a" then "tab" <---- Changes the focus to other region.
"ctrl a" then "ctrl c" <---- Starts new shell in new region.

Now the Local user has a split screen with a regular user session below the root session

Remote <---- Needs help.

"ctrl a" then "shift s" <---- Creates the split.
"ctrl a" then "tab" <---- Changes the focus to other region.
"ctrl a" then "spacebar" <---- Switches the regions session to other running sessions. Hit until you find the regular user prompt.

Now both Local and Remote users have split screens that they both have control over and can see what the other is typing (except for passwords). Either user can do the following.

"ctrl a" then "n 0" <---- To switch to the work region
"ctrl a" then "n 1" <---- To switch to the chatting region, just start each line with a "#"
Code:
#What the heck does that do?
#It updates foo so bar doesn't happen again.
#OK, thanks man, you're the greatest.


If you people don't like the split for chat deal you can kill it off with:

"ctrl a" then "shift X" <---- This kills the region that you are in so make sure you are in the right one.
"ctrl a" then "spacebar" <---- Finds the open session so you can end it.
"exit"

The other user at this point will just have to do the following:

"ctrl a" then "shift X"

You could still use "#" for sending messages it will just be hard or impossible if there is a long emerge going on or something else hogging up the terminal...like "top".

I've used this info to help someone install Gentoo on their computer so they could watch and ask questions.

"man screen" for other stuff that you can do with screen. In "man screen" they use a different convention than I have used here, "C-a tab"

"C-a tab" which means "ctrl a" then "ctrl tab" for switching the input focus to the next region.
"C-a C-c" which means "ctrl a" then "ctrl c" for creating a new window with a shell and switching to that window.
"C-a X" which means "ctrl a" then "shift X" for killing the current region.

You get the drift.
_________________
AssociateX
Gentoo rocks!
Back to top
View user's profile Send private message
krolden
Apprentice
Apprentice


Joined: 28 May 2004
Posts: 293
Location: Belgium

PostPosted: Sun Feb 18, 2007 8:55 pm    Post subject: Reply with quote

I've been using screen for a long while now, but I didn't know about this. Thanks for sharing :)
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5934

PostPosted: Sun Feb 18, 2007 10:14 pm    Post subject: Reply with quote

http://gentoo-wiki.com/TIP_Using_screen :wink:
_________________
Neddyseagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.

banned from #gentoo since sept 2017
Back to top
View user's profile Send private message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Wed Feb 21, 2007 2:32 pm    Post subject: Reply with quote

I like the tab bar, which is also described in the wiki. My personal .screenrc entry looks like this:

Code:
hardstatus alwayslastline "%{bd}[ %{B}%H %{b}][%{B}%-w%-u%{WK}%n-%t%{Bd}%+u%+w %= %{b}][%{B} %D %0d.%0m.%Y %0c %{b}]"


I tried this together with split screen, but it was a bit confusing and probably unnecessary.
Back to top
View user's profile Send private message
senz
n00b
n00b


Joined: 12 Jan 2005
Posts: 19
Location: Frankfurt

PostPosted: Wed Feb 21, 2007 10:24 pm    Post subject: Reply with quote

heh, im using screen on various unix'es since at least 1999, mostly just for detaching irc-sessions, and now i found its so much more useful then i thought it was. im a dumbass :p
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum