How can I save the current working directory in different tabs in a gnome-terminal? I am looking for a script or a command, that will save the working directory of each open tab, without having to manually go through all tabs and type pwd
in the terminal window..
I am using Ubuntu 14.04, and gnome-terminal version 3.6.2.
I tried to save the current state using gnome-terminal --save-config=conf.cfg
The file conf.cfg
will in some cases contain an entry like:
WorkingDirectory=/home/hakon/mydir
. However, that directory is not necessarily the current working directory of the terminal window. It seems it is related to the command line option --working-directory
.. so it will only represent the working directory if I do not change it after the terminal window has opened..
pwd
s so that every time you open a terminal, it will automatically load n new tabs within the respectively saved directory? Or do you want to continuously save thepwd
s every time you close the window? And do you just want to save the info somewhere or instead reopen the tabs whenever you launch a terminal window? Please clarify this.save-pwds
from any terminal tab in the terminal window (assuming I only have one window) and just saves a file with one pwd per line in any order..pwd >> /home/YOURUSERNAME/workingdirs.txt
It will append a line containing the path to the specified file (workingdirs.txt in your home directory). If the file doesn't exist, it will be created. So you can delete it (rm /home/YOURUSERNAME/workingdirs.txt
) before running the script to save a new load. Now the only problem is that I could not find a way to access the terminal window's tabs and run that command in each of them instead of in a new one. This approach will break if a tab is busy