34

I'm using Sublime Text as a notepad and usually I've plenty of un-saved files which usually are re-open after reboot or crash, but I'm afraid to lose them (which happened few times).

Where (in which folder/file) does Sublime Text store these temporary files, so I can do some periodic session backups?

34

Where does Sublime Text store its un-saved windows?

This depends on which operating system your are using.


OSX

Sublime Text 3:

~/Library/Application Support/Sublime Text 3/Local/Session.sublime_session

Sublime Text 2:

~/Library/Application Support/Sublime Text 2/Settings/Auto Save.sublime_session

I'm wondering if there is a location Sublime puts temporary files? I just lost a WP theme I was working on due to MacOSX blundering, wondering if I can get any of the files I was working on back from Sublime temp files.

...

Sublime Text will save auto save information to ~/Library/Application Support/Sublime Text 2/Settings/Auto Save.sublime_session, but it does so on a regular basis, and the chances are it's overwritten by now, unfortunately.

Source Temporary Files location?


Windows

For the settings folder you could look for a unique file using:

F:\>dir license.sublime_license /s /b  

For XP that would return:

F:\Documents and Settings\user\Application Data\Sublime Text 2\Settings\License.sublime_license

Alternatively:

  • Open sublime and go to preferences > browse packages.
  • Then to the parent directory and you'll see the settings subdirectory.

XP

C:\Documents and Settings\user\Application Data\Sublime Text 2\Settings\Auto Save Session.sublime_session

Windows 7

Sublime Text 2:

C:\Users\user\AppData\Roaming\Sublime Text 2\Settings

Sublime Text 3:

C:\Users\user\AppData\Roaming\Sublime Text 3\Local

(section added by barlop)

  • I symlinked this folder into Dropbox for backups, any potential issues with this do you think? Like if dropbox and sublime try to do something to the file at the same time – timhc22 Mar 7 '17 at 13:04
  • @timhc22 No idea. I don't use DropBox or Sublime :) – DavidPostill Mar 7 '17 at 13:05
  • I use Sublime Text 3 on Win 10 and I copied below directory completely to my new laptop which restored all my saved/unsaved open files as were present on my last computer. C:\Users\user_name\AppData\Roaming\Sublime Text 3. All packages got copied too. – gsinha Mar 1 '18 at 3:21
10

Windows 7 64bit, Sublime Text 3 saves its working session (including the contents of tabs that were unsaved when the application was closed) to:

C:\Users\{username}\AppData\Roaming\Sublime Text 3\Local\Session.sublime_session

  • 1
    This is also the case with Windows 10 64Bit – Antony Aug 31 '16 at 2:28
6

In Linux, Sublime text 3 unsaved content is stored in ~/.config/sublime-text-3/Local/Session.sublime_session

4

For Linux

In the Mint distro, the complete file names/paths opened for each tab of Sublime Text 3, can be accessed with this Bash line:

cat $HOME/.config/sublime-text-3/Local/Auto\ Save\ Session.sublime_session |grep "\"file\":" |sed 's/^[[:space:]]*//g' |sed 's/^\"file\"\: \"//g' |sort -u | sed 's/[\",]*//ig'

NOTE: If you use Session.sublime_session instead of "Auto Save Session.sublime_session", you can get different results, with missing tabs/files.

Anyway, this is not 100% reliable, but will get you started. I'm sure you can improve this ugly line, so feel free to comment.

Explanation:

  • 1st sed removes leading white space due to JSON keys
  • 2nd sed remove the "file": " part
  • sort -u (unique) remove filename duplicates
  • 3rd sed remove trailing white space.
2

In Linux, if you are using portable sublime text 2, and did not install it from the repos, you can find it in:

~/.config/sublime-text-2/Settings/Session.sublime_session

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.