## gdb启用history 修改用户home目录下的.gdbinit文件: ```bash [yz@bogon ~]$ vim ~/.gdbinit set history filename ~/.gdb_history set history save on set history size 2000 set history remove-duplicates 1 ``` 注: - ~/.gdbinit文件在gdb启动时会自动读取。 - remove-duplicates设置重复命令保留几条(去重作用)。 ## 参考 - [gdb Document: 22.3 Command History](https://sourceware.org/gdb/onlinedocs/gdb/Command-History.html)