xterm - howto lauch an xterm into a specific directory
hello,
I would like to launch an xterm from my file manager, I'm able to get the directory but not to launch an xterm prompting at this directory... you know ? should not be so geeky, I will be shamy thanks in advance PS: in the same kind of idea, how can I launch something as a specific user into a root owned script ? |
If you are using Konqueror to browse with then it's easy, just "right-click" on the folder and select "Actions" and then select "Open terminal here".
|
As for running as a specific user, you should use the su command to change user id.
|
thanks for your help, but it's not so obvious
I perhaps was not clear enough but I need to script that ! to run an xterm at a specific directory, I tried (as script run by clicking on a directory into the file manager) Code:
dir=$@ Code:
dir=$@ and to run a program hold by a specific using a script launched by root... Code:
echo user: $USER I really need someone's help on that because finding documentation on so precise points is a bit complex Yours sincerely. |
When you open an xterm window, you are effectively logging in. Therefore an xterm session will always start at your home directory. You can use expect:
(http://expect.nist.gov/) to pass commands to the xterm session after you start it. Changing to your desired directory after you have launched xterm would be covered by this. To run a root owned script as a non root user you can use sudo: http://www.courtesan.com/sudo/ |
Quote:
I have found another tip, not perfect but does the trick for me Code:
#!/bin/bash Quote:
Code:
echo user: $USER thanks, you were quick, that's nice ! |
Getting the Prompt After 'xterm -e <command>'
Hi,
I'm trying to do something similar, that is, running a command automatically after launching an xterm window using the 'e' switch. Something like: xterm -e "ls" The problem is that this causes the xterm window to run the command and get destroyed, that is, the command prompt is not available. But when I run the command xterm -e "ls && sudo su" the window stays open and xterm's command prompt is available for further use. But this is not what I want. How do I get the window to stay open and also get the command prompt available (the 'hold' switch does the former, but not the latter)? Thanks, Jayanth |
Anyone...?
|
This is how you launch xterm into directory <dir>
# xterm -e 'cd <dir> && /bin/bash' this is how you would do it with konsole # konsole --workdir <dir> |
Quote:
__________________________ Yes, this thread is 15 years old and dormant; but today it was very timely and relevant to me. |
Quote:
Quote:
|
You can launch an xterm terminal into a specific directory using the following command:
xterm -cd /path/to/directory Replace "/path/to/directory" with the actual path to the directory you want to launch the xterm terminal in. This will open an xterm terminal in the specified directory, allowing you to run commands and navigate the file system from that location. |
All times are GMT -5. The time now is 11:04 AM. |