A
A
Artem Prokhorov2021-09-15 23:44:46
phpstorm
Artem Prokhorov, 2021-09-15 23:44:46

How to choose a default directory when opening a console with an SSH connection?

Well, that is, when connected via ssh, the console opens and I am there in / root. And how to choose the project folder by default. And then you have to constantly do cd ../blab/bsla/anal'a and so on and so forth, tired.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fenix957, 2021-09-16
@Fenix957

Connect to the server
go to the desired folder
Enter

echo $PWD > ~/.bash_lastpwd

add to the end of the file
~/.bashrc

This is
if [ -f ~/.bash_lastpwd ]; then
    cd $(cat ~/.bash_lastpwd)
fi

Disconnect from the server and switch
You are great
And so learn Google 1 link
https://stackoverflow.com/questions/626533/how-can...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question