Skip to content

Instantly share code, notes, and snippets.

@subfuzion
Last active December 8, 2023 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subfuzion/8bd387d99b53a39b1df3b5fd688a8e90 to your computer and use it in GitHub Desktop.
Save subfuzion/8bd387d99b53a39b1df3b5fd688a8e90 to your computer and use it in GitHub Desktop.
Log and review terminal sessions

Sometimes I have a number of terminal sessions open and I want to remember where I left off (for example, when rebooting). I'm sure there's a better way to automate this, but I haven't put thought into it.

For now, I just enter log-session to log the current directory, and later when I want to view previous sessions, I enter sessions.

#!/bin/bash
timestamp() {
printf "%s" $(date +%D)
}
mkdir -p ~/.config/session
printf "%s\t%s\n" $(timestamp) $PWD >> ~/.config/session/history
#!/bin/bash
tail ~/.config/session/history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment