docs:tips_n_tricks:screen.html
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
docs:tips_n_tricks:screen.html [30.07.2010 16:53 CEST] – peter | docs:tips_n_tricks:screen.html [16.03.2024 00:38 CET] (current) – [Logging and reading logs] peter | ||
---|---|---|---|
Line 2: | Line 2: | ||
===== show current directory or command in window name when using zsh ===== | ===== show current directory or command in window name when using zsh ===== | ||
+ | ==== Linux ==== | ||
put this in your '' | put this in your '' | ||
Line 11: | Line 11: | ||
precmd () { | precmd () { | ||
let "len = 54 - ${# | let "len = 54 - ${# | ||
- | screen -X -S " | + | screen -X -S " |
} | } | ||
preexec () { | preexec () { | ||
screen -X -S " | screen -X -S " | ||
+ | _my_last_cmd=" | ||
# # Maybe $2 or $3 is a better choice - I didn't get the difference yet. You may | # # Maybe $2 or $3 is a better choice - I didn't get the difference yet. You may | ||
# # analyse this with the statement: | # # analyse this with the statement: | ||
Line 21: | Line 22: | ||
;; | ;; | ||
esac | esac | ||
+ | |||
+ | ==== Mac OS X ==== | ||
+ | On Mac OS X (maybe on BSD systems in general), screen launches a '' | ||
+ | use the following lines in your '' | ||
+ | case "`ps -o ' | ||
+ | " | ||
+ | *) pppid=" | ||
+ | esac | ||
+ | | ||
+ | case " | ||
+ | "" | ||
+ | ;; | ||
+ | " | ||
+ | eval " | ||
+ | precmd () { | ||
+ | let \"len = 54 - \$# | ||
+ | screen -X -S " | ||
+ | } | ||
+ | preexec () { | ||
+ | screen -X -S \" | ||
+ | } | ||
+ | " | ||
+ | ;; | ||
+ | esac | ||
+ | |||
===== show current directory or command in window name when using bash ===== | ===== show current directory or command in window name when using bash ===== | ||
Line 64: | Line 90: | ||
Actually, I consider this trick dirty and hence both solutions. | Actually, I consider this trick dirty and hence both solutions. | ||
+ | |||
+ | ===== Have a separate history for each screen window ===== | ||
+ | Put this in your '' | ||
+ | |||
+ | [ -n " | ||
===== sample .screenrc file ===== | ===== sample .screenrc file ===== | ||
- | | + | <code screen .screenrc> |
- | bind ^k | + | #remove some stupid / dangerous key bindings |
- | bind ^\ | + | bind ^k |
- | bind k | + | bind ^\ |
- | startup_message off | + | bind k |
- | vbell on | + | # # don't lock screen accidently - use if you don't know the accounts |
- | vbell_msg " Klingeling! " | + | # # password (e.g. when access is managed by ssh keys) |
- | bindkey -k kb stuff ^? | + | # bind x |
- | defscrollback 500 | + | # bind ^x |
- | + | startup_message off | |
- | caption always | + | vbell on |
- | # # show window title and optional | + | vbell_msg " Klingeling! " |
- | # # hardware status line text | + | bindkey -k kb stuff ^? |
- | # caption string " | + | # Enable cycling backward throug regions in Putty by C-a, |
- | # windowlist string | + | bindkey -t " |
- | + | # Make C-a C-a work smooth again | |
- | # show window title if set, | + | bindkey -t " |
- | # else hardware | + | |
- | windowlist string "%3n %? | + | defscrollback 500 |
- | caption | + | |
- | + | # make $HOME the base for all relative paths | |
- | hardstatus on | + | chdir |
- | hardstatus alwayslastline | + | |
- | msgminwait 0 | + | caption always |
+ | # # show window title and optional | ||
+ | # # hardware status line text | ||
+ | # caption string " | ||
+ | |||
+ | # # show window title if set, else hardware status line text | ||
+ | # windowlist string "%3n %?[%h]%:%t%?" | ||
+ | # windowlist title "Num Name|HW Status" | ||
+ | # # show window title and hardware status line text if set | ||
+ | # windowlist string "%3n %t %? | ||
+ | # windowlist title "Num Name [HW Status]" | ||
+ | # # Use approximately original windowlist string appended by hardware | ||
+ | windowlist string "%3n %t%=%? | ||
+ | windowlist title "Num Name%=[HW Status] Flags" | ||
+ | # # show clock in caption line | ||
+ | # caption | ||
+ | # Higlight active window, show hold and escape-key state | ||
+ | caption | ||
+ | |||
+ | hardstatus on | ||
+ | hardstatus alwayslastline | ||
+ | msgminwait 0 | ||
+ | |||
+ | logfile .screenlog/ | ||
+ | |||
+ | zombie xr onerror | ||
+ | # If you're using bash (won't hurt otherwise) | ||
+ | setenv PROMPT_COMMAND ' | ||
+ | </ | ||
+ | ===== Logging and reading logs ===== | ||
+ | <code screenrc .screenrc> | ||
+ | : | ||
+ | chdir | ||
+ | logfile screenlog/ | ||
+ | : | ||
+ | </ | ||
+ | |||
+ | col < ~/ | ||
+ | |||
+ | __References__: | ||
+ | * [[https:// | ||
+ | ===== Starting root shell in new screen with non-default shell ===== | ||
+ | screen -t root sudo ZDOTDIR=$HOME -i /bin/zsh - | ||
+ | screen -t root sudo su - -c " |
docs/tips_n_tricks/screen.html.1280501591.txt.gz · Last modified: 30.07.2010 16:53 CEST by peter