Xfce Forum

Sub domains
 

You are not logged in.

#1 2010-01-19 06:57:02

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

How to keep xfce4-terminal open?

My two most often-used commands are top and ps -ejH. I decided to make a couple of panel launchers for them, with homemade .png icons which read (wait for it) 'top' and 'ps'.

'top' works fine. Click on the icon, and xfce4-terminal opens with top running.

'ps' doesn't. Click on the icon and a terminal window appears and vanishes. I've tried a whole range of possibilities, including specifying various commands for the launcher beginning with 'xfce4-terminal'.

What works is this command: xterm -hold -e ps -ejH. Good old xterm opens, executes ps -ejH and stays open.

There doesn't seem to be a '-hold' option for xfce4-terminal. Any other way I can keep it open with a single command?

Offline

#2 2010-01-19 07:48:13

etnlWings
Member
Registered: 2007-10-30
Posts: 218

Re: How to keep xfce4-terminal open?

Check the man page for exo-open. It might be what you're looking for.

Offline

#3 2010-01-19 08:31:35

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

Hi, etniWings.

Maybe I wasn't clear enough about the problem!

I can launch xfce4-terminal with a panel launcher with any one of a whole range of command options. The problem is that xfce4-terminal closes down after executing ps -ejH in a fraction of a second (I can see it flash by). I can't get it to stay open. This is easy to do with the '-hold' option in xterm, so I'm hoping there's some little-known or clever command option for xfce4-terminal that does this as well.

Offline

#4 2010-01-19 09:41:00

etnlWings
Member
Registered: 2007-10-30
Posts: 218

Re: How to keep xfce4-terminal open?

Does exo-open get around the problem or is it the same deal?

Alternative solution might be to pipe ps' output into a pager like less.

Offline

#5 2010-01-19 10:12:53

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

No, exo-open just launches xfce4-terminal to execute ps -ejH, but it doesn't keep xfce4-terminal open. Same with piping the ps -ejH output to various commands.

However (Ta da!) this almost works (and it won't work with -e instead of -x):

xfce4-terminal -H -x ps -ejH

Problem is, the command doesn't complete and return me to the prompt. I get to see the process tree, but I can't act on it (e.g., kill a process). I have to close the terminal and re-open it.

What can I add to the command to finish ps -ejH and get a prompt? (Yes, I know I could do a script here, but it would be neat to do it just with terminal commands...)

Edit: I actually don't have to close the terminal, I can open a new tab and enter commands there, but it would still be good to do it in the ps tab.

Offline

#6 2010-01-19 10:20:16

ManOfSteel
Member
Registered: 2005-10-06
Posts: 104

Re: How to keep xfce4-terminal open?

Try this as paramters for your xfce4-terminal: "ps -ejH && /bin/csh"
Replace csh with your shell path. Keep the quotation marks.

Offline

#7 2010-01-19 10:26:16

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

Hi, M.O.S.

Thanks for the interesting idea, but with xfce4-terminal -e "ps -ejH && /bin/bash", the terminal appears but doesn't stay open.

Offline

#8 2010-01-19 10:40:55

ManOfSteel
Member
Registered: 2005-10-06
Posts: 104

Re: How to keep xfce4-terminal open?

Could you open a Terminal or Xterm, etc. and try that command from there. Maybe it's returning some error.

Offline

#9 2010-01-19 10:48:59

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

In xfce4-terminal, entering ps -ejH && /bin/bash executes ps -ejH and brings me back to a prompt.

If I launch xfce4-terminal with a panel launcher, either the plain command

xfce4-terminal -e "ps -ejH && /bin/bash"

or

ps -ejH && /bin/bash

with 'Run in terminal' checked gives me the 'now you see it, now you don't' flash-past.

[Logging off, maybe more tomorrow, many thanks]

Offline

#10 2010-01-19 20:59:57

s0ulslack
Member
From: Idaho
Registered: 2005-12-25
Posts: 291

Re: How to keep xfce4-terminal open?

How about just running Conky and always have it visible some where on the desktop?  Sounds like a cleaner solution to what you'd like smile

Offline

#11 2010-01-19 21:29:36

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

Hi, s0ulslack.

Yes, conky is cleaner and prettier - if you have lots of screen real estate. I have a 13" laptop display running at 1280x800 px.

Normally I just do Ctrl+Alt+t (custom keyboard shortcut) to call up xfce4-terminal, then type in commands, and I still do that for most CLI jobs. As a newcomer to Xfce I thought I'd see how far I could push panel launching!

Anyway, xfce4-terminal -H -x ps -ejH does the job. Many thanks.

Offline

#12 2010-01-22 03:26:10

Xfce_User81
Member
Registered: 2010-01-20
Posts: 8

Re: How to keep xfce4-terminal open?

Hey, I had a similar problem, while trying to login to the terminal.  If you run su in the terminal as you open the terminal, then you should have your problem solved.  It worked for me, and I hope it helps.

Offline

#13 2010-01-22 07:04:01

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

Hi, Xfce_User81.

I don't think my reflexes are good enough to enter su in the terminal as it launches. It's only open for a fraction of a second!

Offline

#14 2010-01-23 00:40:13

Xfce_User81
Member
Registered: 2010-01-20
Posts: 8

Re: How to keep xfce4-terminal open?

lol.  I must apologize.  What I meant was for you to run su in terminal before you open.  All you have to do is right-click the terminal icon in your system tray or go to your program launcher.  There is a setting you can change to always run the command su in the terminal as it opens.  Again, sorry for the lack of detail or clearity. Hope that helps.

Offline

#15 2010-01-23 03:43:34

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

Interesting idea. Are you saying I should just su to myself before running the command? (Otherwise I'd be switching to root, which requires a password, which defeats the purpose of a launcher that opens a terminal with the command running.)

I can't see how that would get around the problem, and when I try coupling the commands (and using the Run in terminal option), I get the usual flash-past of a terminal opening and closing in the blink of an eye. Can you suggest a syntax?

P.S. Have you read Richard Stallman's entertaining entry in info su?

Offline

#16 2010-01-23 04:44:13

Xfce_User81
Member
Registered: 2010-01-20
Posts: 8

Re: How to keep xfce4-terminal open?

Sorry, that it wouldn't work.  It worked for me to just run su command in the terminal before I opened the window.  Maybe the distribution you are using requires a different command, such as sudo.  I am running FreeBSD.  Sorry if I am wasting time here.

Offline

#17 2010-01-23 05:47:00

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

Hi, Xfce_User81.

No, no! Not wasting time! This forum is all about trying different things to see if they work. Many thanks for your suggestion, it was definitely worth trying. (And sudo also doesn't work...)

Offline

#18 2010-01-23 10:49:39

ManOfSteel
Member
Registered: 2005-10-06
Posts: 104

Re: How to keep xfce4-terminal open?

I have no idea if su can work, but you could try it with the -m option followed by your user, and the -c option for the command. Check your su man page in case your system has different options.

Offline

#19 2010-01-23 21:07:49

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

Hi, ManOfSteel.

man su says "If the target user has a restricted shell, this option has no effect" for the -m and -p options. No effect: terminal opens and closes.

I'm still trying to get my head around being logged in, then su'ing to myself...

Offline

#20 2010-01-23 22:16:20

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

Deja vu all over again. It looks like exactly this issue was raised and discussed 3 years ago on Ubuntu forums:

http://ubuntuforums.org/archive/index.php/t-296628.html

No fix there, either. It's curious that I can get the command to complete (i.e., and return me to the prompt) with xfce4-terminal "pre-opened", but not when I launch it with that same command.

Offline

#21 2010-01-23 23:52:33

haarp
Member
Registered: 2010-01-17
Posts: 10

Re: How to keep xfce4-terminal open?

Why not use bash magic?

#!/bin/bash

ps -ejH
echo "Press any key to close!"
read

Offline

#22 2010-01-24 00:07:57

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

Hi, haarp.

No reason why I couldn't, but like I said in an earlier post on this thread, "Yes, I know I could do a script here, but it would be neat to do it just with terminal commands...". It's a tinkering instinct. At the moment my only script-by-panel-launch is an rsync. And for ps purposes I'm happy enough with xfce4-terminal -H -x ps -ejH, even though it doesn't complete.

Offline

#23 2010-01-24 00:45:39

ManOfSteel
Member
Registered: 2005-10-06
Posts: 104

Re: How to keep xfce4-terminal open?

Executing commands while switching users should be possible. The only restriction I know of, is when switching to UID 0, which requires that your user be a member of the administrative group (e.g. wheel). I think su itself is working in your case, but it's just doing the same thing as the other commands that you've tried so far and have failed.

But I guess switching to your own user is quite weird, yes.

Why don't you use Xterm (with -hold) just for that command alone?

Offline

#24 2010-01-24 01:33:44

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: How to keep xfce4-terminal open?

This thread's getting so long it's easy to forget previous posts! In my 2nd one I said "I can't get it to stay open. This is easy to do with the '-hold' option in xterm, so I'm hoping there's some little-known or clever command option for xfce4-terminal that does this as well."

I actually like good old xterm, and would use it as default terminal except it doesn't have tabs.

Offline

#25 2010-01-24 01:56:07

Xfce_User81
Member
Registered: 2010-01-20
Posts: 8

Re: How to keep xfce4-terminal open?

Just to clarify my previous post.  I misunderstood the situation.  Late night caused my own confusion.  Sorry for any confusion.  Su didn't work for me in your case.  Another issue I had problems with long ago.

Offline

Board footer

Powered by FluxBB