Transfer Linux Shell History to New WorkStation

MouliVeera
Apr 16, 2024

Locate History File: Find .bash_history (Bash) or .zsh_history (Zsh) in your old Mac’s home directory.
Copy History File: Copy it to a transfer location:

cp ~/.bash_history /path/to/destination

or

cp ~/.zsh_history /path/to/destination

Transfer & Place: Move the file to your new Mac’s home directory.

Merge (Optional): If you have an existing history file on your new Mac, merge contents:

cat /path/to/copied/history/file >> ~/.bash_history

or

cat /path/to/copied/history/file >> ~/.zsh_history

Reload Shell: Restart your terminal or open a new window/tab

Notes:

  • Replace /path/to/destination and /path/to/copied/history/file with actual paths.
  • Ensure appropriate permissions for copying files.
  • Enjoy your command history on your new Mac!

--

--

MouliVeera

Mouli is a seasoned DevOps Engineer with expertise in designing and optimising CI/CD pipelines, containerisation with Docker and Kubernetes.