I didn't like how xterm behaved when I tried to scroll the output of less with my mouse (it scrolls the command history instead of scrolling less). So I got Sakura, and it behaved the way I wanted. However, the '-e' option doesn't seem to work well.

When I type

xterm -e "ls /usr/bin | less"

I get a new xterm where the command ls /usr/bin | less has been executed. However,

sakura -e "ls /usr/bin | less"

seems to ignore my request, and simply starts a new Sakura terminal.

In fact, I've experimented with other terminal emulators and options with no success...

sakura -x "ls /usr/bin | less"
xfce4-terminal -e "ls /usr/bin | less"
roxterm -e "ls /usr/bin | less"
lxterminal -e "ls /usr/bin | less"
lilyterm -e "ls /usr/bin | less"

Some of them ignore my request, and sometimes they claim they say "Failed to execute child process ... (No such file or directory)"

I'm currently on Arch. I've come across http://osdir.com/ml/general/2013-07/msg06468.html, which seems to suggest Sakura had at one point behaved as I would have wished it (I currently have version 3.1.0).

Any help in getting sakura or some other 'nice' terminal emulator to behave as expected would be much appreciated (that is, have the command $TERM -e "ls /usr/bin | less" open up a terminal emulator with the given command executed and have the output of less be scrollable with mouse wheel).


sakura seems to be broken, but for others, there are two main types: those that take one argument after -e and treat it as a shell command line and those that take a list of arguments and the first one is used to derive the command to execute (no shell is involved so shell features like pipes can't be used.

xterm, as a special case will fall in the second category if there are more than one argument or the one argument resolves (by lookup in $PATH) to an existing executable, and in the second category otherwise.


xterm -e 'ls | less'

Will run the /usr/bin/ls | less executable for instance (yes a file name with spaces and pipe characters) with ls | less as first argument if it exists, or otherwise (more likely), /bin/sh with, sh, -c, ls | less otherwise.

In most other terminals (and that's recommended as well in xterm as well to lift the ambiguity), you need to call sh explicitely:

lxterminal -e sh -c 'ls | less'

sakura's -e seems not to be working. It's -x works to some extent. You can do:

sakura -x 'sh -c "ls | less"'

It seems to do a shell-like parsing of the single argument passed to -x, split that into a list of arguments, and then execute that.

About scrolling in less. It works in sakura (and other VTE-based terminal emulators) because when in the alternate screen (as if after issuing tput smcup), the scroll down and up events send the same escape sequences as when pressing the Down and Up keys.

You'll notice that it doesn't work with ls | less -X, where smcup is not issued.

xterm supports that as an option, not enabled by default. You can change it by setting the XTerm.VT100.alternateScroll resource to true, for instance, by adding:

XTerm.VT100.alternateScroll: true

to your ~/.Xdefaults (for xterms started on that machine), or in the resource file loaded into your X server (for xterms started anywhere and connecting to your X server), or calling xterm with:

xterm -xrm 'XTerm.VT100.alternateScroll: true' -e sh -c 'ls | less'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.