PROBLEM DESCRIPTION or QUESTION
...
When I call Xftp from Xshell, it opens to the user's home directory, not the directory I'm currently working on in Xshell.
RESOLUTION
...
You If you'd like to accomplish any of the following, Xshell must know the current working directory:
Moving to the working directory when cloning a session in Xshell
Move to the working directory when calling Xftp from Xshell
Have files and directories in the current working directory appear in File Manager
Therefore, you need to configure the terminal(shell) to relay its title message to Xshell upon every directory change. To do this, you'll need the following:
The terminal title message code: the message between the \033(\e)]0;
...
and \007(\a) codes
A setting where a command is executed every time new prompt is displayed.
The PROMPT_COMMAND or PS1 environment variables are used in BASH
Basically, a terminal emulator cannot know in which directory a user is working. But there is a way in which the terminal can determine the working directory under a restricted condition.
...
The following example demonstrates how to change the terminal's title for the most frequently used shell, BASH. If you use a different shell, please refer to the following article: https://tldp.org/HOWTO/Xterm-Title-4.html
Use BASH or a BASH-like shell.
Set the TERM type to xterm or something similar (e.g. xterm-color). This may not be mandatory in some of the more recent Unix/Linux systems.
Code Block $ export TERM=xterm
Configure the PROMPT_COMMAND variable to manage the title bar. Try the following:
Code Block $ export PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
As you can see, the current directory information, $PWD, is included in the PROMPT_COMMAND.
This is only an example. You can create your own desired title bar message. If you do, keep in mind that the path information should be located at the end of the title message. Xshell will parse the path from the first slash(/) or tilde(~) to the end of the title message.Check if Xshell's title bar or tab changes after you change working directories.
You can now see that the current working directory changed to /usr/bin: