Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Command history in Fish

📅 2016-Dec-15 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ fish, history ⬩ 📚 Archive

Fish maintains a history of all commands you have executed.

$ history
$ history --show-time

Note that this is a very useful feature to check when a particular command was executed. However, this feature was only added in Fish 2.4.0 and is not available in older versions.

$ history foo
$ history --merge

Fish does this merge only when it is exited. This is because Fish does not want to update the common history file at the end of every command. This might be for performance and to avoid race conditions.

However, sometimes you execute a long command in one Fish session and might want to repeat that in another session. This is a quick way to merge all histories, so that that command is now available in history of the second session for easy autocompletion.

Tried with: Fish 2.4.0 and Ubuntu 14.04