Что такое полезные .screenrc настройки?

Самое легкое (и самый дешевый) метод должно просто использовать Резервное копирование Windows Server в Сервере 2008.

Как создать резервную копию Hyper-V с Резервным копированием Windows Server

Снимки должны использоваться в качестве краткосрочного решения для отката и не должны использоваться в традиционных целях резервирования. Посмотрите здесь для краткого объяснения.

54
задан 4 May 2009 в 03:48
12 ответов

Для тех, которые желают менее загадочный способ разбудить хороший экранный набор, я могу сердечно рекомендовать byobu (раньше названные экранные профили). Это дает Вам хороший набор по умолчанию материала внизу экрана - нижняя строка содержит различную удобную информацию о статусе, и второе от нижней строки содержит список Ваших экранных окон. Все это может быть настроено в хорошем легком ncurses меню путем нажатия F9.

Функциональные клавиши отображаются на общих операциях:

  • F2 - создайте новое окно
  • F3 - Перейдите к предыдущему окну
  • F4 - Перейдите к следующему окну
  • F5 - Профиль перезагрузки
  • F6 - Отсоединение от сессии
  • F7 - Перейдите к scrollback режиму
  • F8 - Просмотрите все привязки клавиш
  • F9 - Настройте экранные профили
  • F12 - Заблокируйте этот терминал

См. эту статью для учебные и снимки экрана.

Byobu находится в репозиториях человечности от кармического (9.10) вперед. В бойком это назвали экранными профилями. Перед этим это может быть установлено от этого ppa от этой страницы загрузки. Это широко упаковывается для других актуальных дистрибутивов также.

Это действительно зависит от Python, но после того как у Вас есть byobu, настроенный, поскольку Вам нравится он, у Вас может быть он, генерируют шар tar, содержащий все, что необходимо воссоздать экран на другой использующий компьютеры byobu-экспорт.

22
ответ дан 28 November 2019 в 19:35
  • 1
    Экранные профили потрясающие . Я собирался ответить тем же. –  jtimberman 10 June 2009 в 21:36

Я также не могу жить без строки меню. Одной вещью мне не нравится ставить меню, которое имеет много людей, является время; это препятствует тому, чтобы прокрутка PuTTY назад осталась прокрученной назад (так как это рассмотрело экранное обновление),

0
ответ дан 28 November 2019 в 19:35
  • 1
    Вы могли использовать screen' s встроенный scrollback? C-A [ по умолчанию поместит Вас в режим копии и позволит Вам перемещаться по своей текущей вкладке с помощью команд клавиатуры как текстовый редактор? –  Murali Suriar 28 May 2009 в 14:19

Самая полезная экранная настройка, по моему скромному мнению, должна изменить модифицирующую клавишу на что-то другое, чем C-a. Это просто слишком важно из ключа для еды (перейдите к началу строки при всех подсказках readline, и в emacs). Я использую C-z, так как я должен приостанавливать приложения намного менее часто, чем я должен отредактировать что-то в начале строки.

Волшебное слово:

escape ^za
10
ответ дан 28 November 2019 в 19:35
  • 1
    я установил мой на ctrl-K потому что it' s наименее наиболее часто используемая клавиша Ctrl в приложениях, которые я использую. ^A слишком полезен в bash/readline для принесения в жертву. –  cas 18 July 2009 в 08:09

Я также использую справедливо включенную caption/hardstatus комбинацию строки, для моделирования эффекта выпадающих вкладок (строка подписи чисто сера, и текущая вкладка в hardstatus является тем же цветом).

У меня также есть своя оболочка, говорят экран, что имя текущего процесса и в каком каталоге я нахожусь, таким образом, мои имена вкладки остаются в курсе, с каким я делаю на каждой вкладке. Это очень важно для запоминания, что я делаю где, не имея необходимость просматривать все мои открытые вкладки.

 # don't use the hardstatus line for system messages, use reverse video instead
 # (we'll be using it for the list of tab windows - see hardstatus alwayslastline
 # below)
 hardstatus off

 # use the caption line for the computer name, load, hstatus (as set by zsh), & time
 # the caption line gets repeated for each window being displayed (using :split),
 # so we'll use color cues to differentiate the caption of the current, active
 # window, and the others.
 #    always                  - display the caption continuously.  Since
 #                              hardstatus is 'alwayslastline', it will be on the
 #                              next to last line.
 #    "%?%F"                  - if (leading '%?') this region has focus ('%F') 
 #                              (e.g. it's the only region being displayed, or,
 #                              if in split-screen mode, it's the currently active
 #                              region)
 #      "%{= Kk}"               - set the colorscheme to blac[k] on grey (bright blac[K]),
 #                                with no other effects (standout, underline, etc.)
 #    "%:"                    - otherwise ('%:' between a pair of '%?'s)
 #      "%{=u kR}"              - set the colorscheme to [R]ed on blac[k], and
 #                                underline it, but no other effects (bold, standout, etc.) 
 #    "%?"                    - end if (trailing '%?')
 #    "  %h "                 - print two spaces, tthne the [h]ardstatus of the
 #                              current tab window (as set by zsh - see zshrc) and
 #                              then another space.
 #    "%-024="                - either pad (with spaces) or truncate the previous
 #                              text so that the rest of the caption string starts
 #                              24 characters ('024') from the right ('-') edge of
 #                              the caption line.
 #                              NOTE: omitting the '0' before the '24' would pad
 #                              or truncate the text so it would be 24% from the
 #                              right.
 #    "%{+b}                  - add ('+') [b]old to the current text effects, but
 #                              don't change the current colors.
 #    " %C:%s%a %D %d %M %Y"  - print the [C]urrent time, a colon, the [s]econds,
 #                              whether it's [a]m or pm, the [D]ay name, the [d]ay
 #                              of the month, the [M]onth, and the [Y]ear.
 #                              (this takes up 24 characters, so the previous
 #                              pad/truncate command makes sure the clock doesn't
 #                              get pushed off of the caption line)
 #    "%{= dd}"               - revert to the [d]efault background and [d]efault
 #                              foreground colors, respectively, with no ('= ')
 #                              other effects.
 #  other things that might be useful later are
 #    " %H"                   - print a space, then the [H]ostname.
 #    "(%{.K}%l%{-}):"        - print a '(', then change the text color to grey
 #                              (aka bright blac[K]), and print the current system
 #                              [l]oad.  Then revert to the previous colorscheme
 #                              ('%{-}') and print a close ')' and a colon.
 #                              NOTE: the load is only updated when some other
 #                              portion of the caption string needs to be changed
 #                              (like the seconds in the clock, or if there were a
 #                              backtick command)
 #    "%0`"                   - put the output of a backtick command in the line
 #    "%-024<"                - don't pad, just truncate if the string is past 24
 #                              characters from the right edge
 #    "%-="                   - pad (with spaces) the previous text text so that
 #                              the rest of the caption string is justified
 #                              against the right edge of the screen.
 #                              NOTE: doesn't appear to truncate previous text.
 caption always           "%?%F%{= Kk}%:%{=u kR}%?  %h %-024=%{+b} %C%a %D %d %M %Y%{= db}"
 # use the hardstatus line for the window list
 #    alwayslastline      - always display the hardstatus as the last line of the
 #                          terminal
 #    "%{= kR} %-Lw"      - change to a blac[k] background with bright [R]ed text,
 #                          and print all the tab [w]indow numbers and titles in
 #                          the [L]ong format (ie with flags) upto ('-') the
 #                          current tab window
 #    "%{=b Kk} %n%f %t " - change to grey (bright blac[K]) background with
 #                          [b]old blac[k] text, with no other effects, and print
 #                          the [n]umber of the current tab window, any [f]lags it
 #                          might have, and the [t]itle of the current tab window
 #                          (as set by zsh - see zshrc).
 #                          NOTE: the color match with the caption line makes it
 #                          appear as if a 'tab' is dropping down from the caption
 #                          line, highlighting the number & title of the current
 #                          tab window.  Nifty, ain't it)
 #    "%{-}%+Lw "         - revert to the previous color scheme (red on black)
 #                          and print all the tab [w]indow numbers and titles in
 #                          the [L]ong format (ie with flags) after ('+') the
 #                          current tab window.
 #    "%=%{= dd}"         - pad all the way to the right (since there is no text
 #                          that follows this) and revert to the [d]efault
 #                          background and [d]efault foreground colors, with no
 #                          ('= ') other effects.
 hardstatus alwayslastline "%{= kR} %-Lw%{=b Kk} %n%f %t %{-}%+Lw %=%{= dd}"

Таким образом, вот мои zshrc настройки для сообщения экрана о том, что я делаю на каждой вкладке.

# ~/.zshrc
# if using GNU screen, let the zsh tell screen what the title and hardstatus
# of the tab window should be.
if [[ $TERM == "screen" ]]; then
  _GET_PATH='echo $PWD | sed "s/^\/Users\//~/;s/^~$USER/~/"'

  # use the current user as the prefix of the current tab title (since that's
  # fairly important, and I change it fairly often)
  TAB_TITLE_PREFIX='"`'$_GET_PATH' | sed "s:..*/::"`$PROMPT_CHAR"'
  # when at the shell prompt, show a truncated version of the current path (with
  # standard ~ replacement) as the rest of the title.
  TAB_TITLE_PROMPT='$SHELL:t'
  # when running a command, show the title of the command as the rest of the
  # title (truncate to drop the path to the command)
  TAB_TITLE_EXEC='$cmd[1]:t'

  # use the current path (with standard ~ replacement) in square brackets as the
  # prefix of the tab window hardstatus.
  TAB_HARDSTATUS_PREFIX='"[`'$_GET_PATH'`] "'
  # when at the shell prompt, use the shell name (truncated to remove the path to
  # the shell) as the rest of the title
  TAB_HARDSTATUS_PROMPT='$SHELL:t'
  # when running a command, show the command name and arguments as the rest of
  # the title
  TAB_HARDSTATUS_EXEC='$cmd'

  # tell GNU screen what the tab window title ($1) and the hardstatus($2) should be
  function screen_set()
  {
    # set the tab window title (%t) for screen
    print -nR $'\033k'$1$'\033'\\\

    # set hardstatus of tab window (%h) for screen
    print -nR $'\033]0;'$2$'\a'
  }
  # called by zsh before executing a command
  function preexec()
  {
    local -a cmd; cmd=(${(z)1}) # the command string
    eval "tab_title=$TAB_TITLE_PREFIX$TAB_TITLE_EXEC"
    eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX$TAB_HARDSTATUS_EXEC"
    screen_set $tab_title $tab_hardstatus
  }
  # called by zsh before showing the prompt
  function precmd()
  {
    eval "tab_title=$TAB_TITLE_PREFIX$TAB_TITLE_PROMPT"
    eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX$TAB_HARDSTATUS_PROMPT"
    screen_set $tab_title $tab_hardstatus
  }
fi
12
ответ дан 28 November 2019 в 19:35

Команда обратной галочки довольно отлична. Читайте об этом на экране человека. Я использую его как так:

backtick 1 15 15 $HOME/bin/cpuusage
# now add '%1`%% CPU' to your hardstatus string. Result is like 38.4% CPU.

Мой cpuusage сценарий для Linux и Mac:

#!/bin/bash
if [[ $(uname) == "Darwin" ]]; then
    top -i1 -l2 -n0|awk '/CPU/{i+=1; gsub(/%/,"",$0);p=substr(sprintf("%3.2f",$8+$10),0,4);if(i==2){printf "%g", p}}'
  else
    awk 'NR==1 {p=substr(sprintf("%3.2f", ($2+$3)/($2+$3+$4+$5)*100),0,4); printf "%g", p;}'</proc/stat
fi
1
ответ дан 28 November 2019 в 19:35

Я часто имею больше чем 10 выполнений окон и хотел способ выбрать их. Я узнал, как настроить C-a Shift+0 до 9 для выбора окон 10 - 19.

bind  ! select 11
bind  @ select 12
bind \# select 13
bind  $ select 14
bind  % select 15
bind \^ select 16
bind  & select 17
bind  * select 18
bind  ( select 19
bind  ) select 10

Отметьте Escape на # и ^.

9
ответ дан 28 November 2019 в 19:35

У меня есть набор F11 и F12 для циклического повторения через окна, делает это более быстрым для перемещения между окнами, специально для окон> 10

# Bind F11 and F12 (NOT F1 and F2) to previous and next screen window
bindkey -k F1 prev
bindkey -k F2 next
0
ответ дан 28 November 2019 в 19:35

При использовании urxvt следующее позволит CTRL+LEFT и CTRL+RIGHT использоваться для перемещения в предыдущее и следующее окно вкладки:

bindkey "^[Od" prev  # ctrl-left
bindkey "^[Oc" next  # ctrl-right

Повторное подключение к удаленной экранной сессии, которая должна всегда работать или сразу созданная:

bind V screen -t MYTABNAME ssh -t MYUSERNAME "screen -x main || screen -R -S main"

Выключение управления потоком по умолчанию позволяет Вам использовать CTRL+R в rtorrent правильно:

defflow off

При выполнении rtorrent как демон с его собственной учетной записью пользователя, этот .screenrc может быть полезным:

vbell off
startup_message off
escape ^Rr
screen -t rtorrent rtorrent
multiuser on
acladd YOURUSERNAME
defflow off
0
ответ дан 28 November 2019 в 19:35

Я использую Ctrl + Alt + Left и Ctrl + Alt + Right для переключения между окнами экрана. Для своего канала IRSSI я использую Alt + Left и Alt + Right, а для переключения рабочего пространства GNOME я использую Ctrl + Alt + Shift + Left / Right. Это кажется сложным, но на самом деле работает очень хорошо.

Коды символов для терминала GNOME отличаются от кодов символов при подключении через PuTTy, поэтому мне пришлось продублировать записи. Вы можете использовать cat> / dev / null , чтобы узнать подходящие для вас коды символов.

#     KEYBOARD SHORTCUTS    #
# execute 'cat > /dev/null' to see the character codes

# Change Escape Combination to Ctrl+f (Ctrl+a is too useful to lose)
escape ^Ff

# PREVIOUS WINDOW
# Ctrl + Alt + Left from gnome-terminal
bindkey ^[[1;7C prev

# Ctrl+Alt+Left from putty
bindkey ^[^[[D prev

# NEXT WINDOW
# Ctrl + Alt + Right from gnome-terminal
bindkey ^[[1;7D next

# Ctrl+Alt+Right from putty
bindkey ^[^[[C next
2
ответ дан 28 November 2019 в 19:35

Устали от полноэкранных программ, таких как vim, оставшихся в буфере прокрутки после того, как вы их закрыли ? Разве не было бы замечательно, если бы они исчезли полностью, как они это делают, когда вы не используете экран? Попробуйте поместить это в ваш файл ~ / .screenrc ...

altscreen on
6
ответ дан 28 November 2019 в 19:35

Основываясь на ответах на Как заставить экран Gnu загружать мой профиль bash , я бы добавил:

shell -$SHELL

в ваш ~ / .screenrc , чтобы экран запускал оболочки входа в систему. Это очень полезно, если вы хотите, чтобы ваш ~ / .bash_profile выполнялся при использовании оболочки через экран .

0
ответ дан 28 November 2019 в 19:35
# disable C-a s, which freezes the screen; can be resolved with C-a q
bind s 
0
ответ дан 28 November 2019 в 19:35

Теги

Похожие вопросы