strace man
reveals that it just calls pager
.
man pager
reveals that pager
is actually less
. And indeed
$ ls -al /usr/bin/pager
lrwxrwxrwx 1 root root 23 2009-08-18 17:30 /usr/bin/pager -> /etc/alternatives/pager
lrwxrwxrwx 1 root root 13 2009-08-18 17:19 /etc/alternatives/pager -> /usr/bin/less
so less has some presets which are invoked when called by the name pager
.
Actually strace also reveals these environment variables:
"LESSCHARSET=utf-8",
"LESS=-ix8RmPm Manual page less(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e
(END):?pB %pB\\%..$PM Manual page less(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e
(END):?pB %pB\\%..$",
So that's it!
Launching anything from .zshenv
is definitely the wrong approach. This file is executed by every instance of zsh
, even when running a script. Use .zshrc
for things that should be done in interactive shells, and .profile
(or .zprofile
, if you've set zsh as your login shell) for things that should be done when you log in.
If you want tmux in every terminal, start tmux directly under the terminal, e.g., gnome-terminal -e tmux
(change your GUI launcher to pass these arguments). You can pass arguments even with -e
(though be careful with quoting), e.g. gnome-termminal -e 'tmux -s ~/.alternate.tmux.conf'
.
If you also want to start tmux when you log in over ssh, you'll have to launch it from your ~/.profile
. Do this only if the parent process of the login shell is sshd
:
parent_process_name=$(ps -o comm= -p $PPID`)
case ${parent_process_name##*/} in
sshd) type tmux >/dev/null 2>/dev/null && exec tmux;;
esac
Another approach to starting tmux over ssh would be to obtain a session name from the environment. That way you could attach to an existing session. The easiest way is to write a small script on the server side, e.g. ~/bin/tmux-login-session
:
#!/bin/sh
if tmux has-session -t "$1"; then
exec tmux attach-session -t "$1"
else
. ~/.profile
exec tmux new-session -s "$1"
fi
Then use an ssh command like the following:
ssh -t hostname.example.com bin/tmux-login-session SESSION_NAME
Best Answer
Found it. This site provides a good explanation of a solution.
In your bashrc, it would look like:
Personally, I don't think I would add it to my bashrc, because the DEBUG combined with trace does throw out a load of garbage when all your shell starts. If you can live with that, it actually does work. It does display the entire command, however, not just the first word.