2

Every so often, after a day or so of uptime, my terminal emulators (I've tested multiple) begin opening in a directory other than $HOME. I'm running Fedora 32 (though this happened on previous versions). A reboot "fixes" this (temporarily). This is also not a bash problem (as previously stated), the same issue occurs with zsh.

Why is this?

uname -a output:

Linux anarchy 5.6.7-300.fc32.x86_64 #1 SMP Thu Apr 23 14:13:50 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
3
  • 3
    How are you opening the terminals?
    – icarus
    May 4 '20 at 4:47
  • 1
    What directory does it open in? Is it always the same? When this happens, what is the output of echo $HOME? What happens if you run cd with no arguments?
    – terdon
    May 4 '20 at 8:42
  • What terminal emulator are you using? Does its preferences say to start a shell in a particular directory? Maybe renaming your machine from "anarchy" to "compliance" would help? (that last thing was a joke).
    – Kusalananda
    May 4 '20 at 9:29
2

A user on Reddit's r/linuxquestions pointed out that the terminal emulator starts in whatever directory its parent process is in.

Every so often, plasmashell (KDE's shell and panel) glitches out, and I need to restart it. What I hadn't realized was I restarted it in a directory that was not the home directory. When launching a terminal emulator from plasmashell's application menu, the terminal emulator opens in the directory that plasmashell was started in.

The solution is to either start the terminal emulator differently, or restart plasmashell in the home directory.

3
  • You could also just add cd "$HOME" to the end of your ~/.bashrc.
    – terdon
    May 4 '20 at 13:00
  • Not if I want additional terminal tabs to open in the same directory
    – 3nki
    May 4 '20 at 20:43
  • Ah, yes indeed. Good point.
    – terdon
    May 4 '20 at 21:20

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.