Screen: Difference between revisions
m Text replacement - "</code>" to "}}" |
formatting |
||
| Line 2: | Line 2: | ||
== Disable Visual Bell == | == Disable Visual Bell == | ||
To disable the visual bell for the current screen instance, hit: | To disable the visual bell for the current screen instance, hit: | ||
{{highlight|lang=text|code= | |||
Ctrl+a Ctrl+g | |||
}} | |||
For a permanent fix, put the following into the {{code|~/.screenrc}} file | For a permanent fix, put the following into the {{code|~/.screenrc}} file | ||
| Line 10: | Line 12: | ||
vbell off # Turns visual bell off | vbell off # Turns visual bell off | ||
}} | }} | ||
== Force Background Redraw == | == Force Background Redraw == | ||
Screen will sometimes mess with any background colors set by programs such as vim. This will cause weird visuals in the terminal where background colors are only rendered where there is text. | Screen will sometimes mess with any background colors set by programs such as vim. This will cause weird visuals in the terminal where background colors are only rendered where there is text. | ||
You can force screen to redraw the entire area such that the background colors are preserved by putting the following in your {{code|.screenrc}} file: | You can force screen to redraw the entire area such that the background colors are preserved by putting the following in your {{code|.screenrc}} file: | ||
{{highlight|lang=text|code= | |||
defbce on | |||
}} | |||
== Scrollback Buffer == | == Scrollback Buffer == | ||
.screenrc | Edit {{code|.screenrc}} with: | ||
{{highlight|lang=text|code= | |||
defscrollback 5000 | |||
}} | |||
Scroll back in a screen terminal by hitting: | |||
{{code|Ctrl-a [}} | |||
Navigate using: | |||
{| | |||
/ | ! Key | ||
? | ! Movement | ||
|- | |||
| h || Move the cursor left by one character | |||
|- | |||
| j || Move the cursor down by one line | |||
|- | |||
| k || Move the cursor up by one line | |||
|- | |||
| l || Move the cursor right by one character | |||
|- | |||
| 0 || Move to the beginning of the current line | |||
|- | |||
| $ || Move to the end of the current line. | |||
|- | |||
| G || Moves to the specified line (defaults to the end of the buffer). | |||
|- | |||
| C-u || Scrolls a half page up. | |||
|- | |||
| C-b || Scrolls a full page up. | |||
|- | |||
| C-d || Scrolls a half page down. | |||
|- | |||
| C-f || Scrolls the full page down. | |||
|- | |||
| / || Search forward | |||
|- | |||
| ? || Search backward | |||
|} | |||
== Rename Screen Session == | == Rename Screen Session == | ||
In a screen terminal, enter {{code|Ctrl-a :sessionname}} followed by the new name. | |||
''Eg'': | |||
{{highlight|lang=terminal|code= | |||
# screen -ls | |||
There are screens on: | |||
8570.test (Attached) | |||
## Hit Ctrl-a :sessionname Hello | |||
# screen -ls | |||
There are screens on: | |||
8570.Hello (Attached) | |||
}} | |||
== Lock a Session == | == Lock a Session == | ||
You can use screen to lock the virtual terminal by using the | You can use screen to lock the virtual terminal by using the {{code|Ctrl-x}} key. | ||
key. | |||
== Running a command detached == | == Running a command detached == | ||
To run a command in a screen session in the background, use: | To run a command in a screen session in the background, use: | ||
{{code|screen -S screenname -dm command}} | |||
== Running screen through su == | == Running screen through su == | ||
If you are running screen not directly through the terminal (such as through su), you will get the following error message: | If you are running screen not directly through the terminal (such as through su), you will get the following error message: | ||
{{highlight|lang=terminal|code= | |||
$ screen | |||
Cannot open your terminal '/dev/pts/0' - please check. | |||
}} | |||
You can remedy this using script: | You can remedy this using script: | ||
{{highlight|lang=terminal|code= | |||
$ script /dev/null | |||
$ screen # Rerun script while in a typescript session | |||
}} | |||
== Serial == | == Serial == | ||
Revision as of 00:41, 6 March 2017
Disable Visual Bell
To disable the visual bell for the current screen instance, hit:
Ctrl+a Ctrl+g
For a permanent fix, put the following into the ~/.screenrc file
vbell_msg "bell: window ~%" # Message for visual bell
vbellwait 2 # Seconds to pause the screen for visual bell
vbell off # Turns visual bell off
Force Background Redraw
Screen will sometimes mess with any background colors set by programs such as vim. This will cause weird visuals in the terminal where background colors are only rendered where there is text.
You can force screen to redraw the entire area such that the background colors are preserved by putting the following in your .screenrc file:
defbce on
Scrollback Buffer
Edit .screenrc with:
defscrollback 5000
Scroll back in a screen terminal by hitting:
Ctrl-a [
Navigate using:
| Key | Movement |
|---|---|
| h | Move the cursor left by one character |
| j | Move the cursor down by one line |
| k | Move the cursor up by one line |
| l | Move the cursor right by one character |
| 0 | Move to the beginning of the current line |
| $ | Move to the end of the current line. |
| G | Moves to the specified line (defaults to the end of the buffer). |
| C-u | Scrolls a half page up. |
| C-b | Scrolls a full page up. |
| C-d | Scrolls a half page down. |
| C-f | Scrolls the full page down. |
| / | Search forward |
| ? | Search backward |
Rename Screen Session
In a screen terminal, enter Ctrl-a :sessionname followed by the new name.
Eg:
# screen -ls
There are screens on:
8570.test (Attached)
## Hit Ctrl-a :sessionname Hello
# screen -ls
There are screens on:
8570.Hello (Attached)
Lock a Session
You can use screen to lock the virtual terminal by using the Ctrl-x key.
Running a command detached
To run a command in a screen session in the background, use:
screen -S screenname -dm command
Running screen through su
If you are running screen not directly through the terminal (such as through su), you will get the following error message:
$ screen
Cannot open your terminal '/dev/pts/0' - please check.
You can remedy this using script:
$ script /dev/null
$ screen # Rerun script while in a typescript session
Serial
You can use screen as a serial console as well.
screen /dev/ttyS0 <baud>[,<options>]
Common baud rates are 9600 or 115200.