{"id":87300,"date":"2021-05-19T09:19:36","date_gmt":"2021-05-19T00:19:36","guid":{"rendered":"https:\/\/softantenna.com\/wp\/?p=87300"},"modified":"2021-05-19T09:19:36","modified_gmt":"2021-05-19T00:19:36","slug":"shellhistory","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/shellhistory\/","title":{"rendered":"ShellHistory - \u30b7\u30a7\u30eb\u306e\u5c65\u6b74\u3092\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3001\u540c\u671f\u3001\u6574\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308bMac\u7528\u30a2\u30d7\u30ea"},"content":{"rendered":"<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2021\/05\/s_20210518_140610.jpg\" alt=\"S 20210518 140610\" title=\"s_20210518_140610.jpg\" border=\"0\" width=\"1098\" height=\"605\" \/><\/p>\n<p>Linux\u3084macOS\u3067\u4f7f\u7528\u3059\u308b\u300c\u30b7\u30a7\u30eb\u300d\u306b\u306f\u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u5c65\u6b74\u3092\u4fdd\u5b58\u3059\u308b\u6a5f\u80fd\u304c\u642d\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30b7\u30a7\u30eb\u81ea\u4f53\u306b\u3082\u4fdd\u5b58\u3057\u305f\u5c65\u6b74\u3092\u691c\u7d22\u3057\u3001\u518d\u5229\u7528\u3059\u308b\u305f\u3081\u306e\u6a5f\u80fd\u306f\u642d\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001GUI\u3067\u5c65\u6b74\u3092\u7ba1\u7406\u3057\u305f\u308a\u3001\u5c65\u6b74\u3092\u540c\u671f\u3057\u305f\u308a\u3068\u3044\u3063\u305f\u6a5f\u80fd\u306f\u5229\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u672c\u65e5\u7d39\u4ecb\u3059\u308b\u300c<a href=\"https:\/\/loshadki.app\/shellhistory\/\">ShellHistory<\/a>\u300d\u306f\u3053\u308c\u3089\u306e\u6a5f\u80fd\u3092\u88dc\u3046\u3053\u3068\u304c\u3067\u304d\u308bMac\u7528\u30a2\u30d7\u30ea\u3067\u3059\u3002<\/p>\n<p>ShellHistory\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u554f\u984c\u3092\u89e3\u6c7a\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30b7\u30a7\u30eb\u306e\u5c65\u6b74\u3092SQLite\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58\u3057iCloud\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3059\u308b\u3053\u3068\u3067\u5b89\u5168\u6027\u3092\u4fdd\u3064\u3002<\/li>\n<li>SQLite\u306eFull-Text Search\u30a8\u30f3\u30b8\u30f3\u3092\u6d3b\u7528\u3057\u691c\u7d22\u3092\u5f37\u5316\u3002<\/li>\n<li>Exit Code\u3001\u4f5c\u696d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3001\u30db\u30b9\u30c8\u3001\u30e6\u30fc\u30b6\u30fc\u3001\u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u6642\u9593\u3001\u30bb\u30c3\u30b7\u30e7\u30f3ID\u3092\u542b\u3081\u3066\u5c65\u6b74\u306b\u4fdd\u5b58\u3002<\/li>\n<li>\u30b7\u30a7\u30eb\u306e\u5c65\u6b74\u304b\u3089\u30b3\u30de\u30f3\u30c9\u3092\u30ce\u30fc\u30c8\u306b\u307e\u3068\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/li>\n<li>\u5b9f\u884c\u3057\u305f\u30b3\u30de\u30f3\u30c9\u306e\u7d4c\u904e\u6642\u9593\u304c\u8a18\u9332\u3055\u308c\u308b\u305f\u3081\u3001\u30d3\u30eb\u30c9\u6642\u9593\u3092\u6bd4\u8f03\u3067\u304d\u308b\u3002<\/li>\n<\/ul>\n<p>2017\u5e74\u306b\u4f5c\u6210\u3055\u308c\u305fDBHist\u30c4\u30fc\u30eb\u306e\u767a\u5c55\u7cfb\u3060\u3068\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u4f7f\u7528\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2>ShellHistory\u306e\u4f7f\u7528\u65b9\u6cd5<\/h2>\n<p>ShellHistory\u306f11.99\u30c9\u30eb(\u8a18\u4e8b\u57f7\u7b46\u6642\u30bb\u30fc\u30eb\u671f\u9593\u4e2d\u30675.99\u30c9\u30eb)\u306e\u6709\u6599\u30a2\u30d7\u30ea\u3067\u3059\u3002Mac App Store\u304b\u3089\u8cfc\u5165\u3059\u308b\u304b\u3001\u516c\u5f0f\u30b5\u30a4\u30c8\u304b\u3089\u6a5f\u80fd\u5236\u9650\u306a\u3057\u306714\u65e5\u9593\u4f7f\u3048\u308b\u8a66\u7528\u7248\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\n<div class=\"app-box clearfix\"><a href=\"https:\/\/apps.apple.com\/jp\/app\/shellhistory\/id1564015476?mt=12&uo=4\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" class=\"app-icon\" src=\"https:\/\/is5-ssl.mzstatic.com\/image\/thumb\/Purple115\/v4\/10\/9d\/ab\/109dab62-cbc3-80c3-ded0-d36fe4fa7e22\/source\/60x60bb.png\" \/><b>ShellHistory<\/b> <span class=\"app-badge-outer\"><span class=\"app-badge-inner\">Mac App Store<\/span><\/span><\/a><br \/>\u30ab\u30c6\u30b4\u30ea: \u958b\u767a\u30c4\u30fc\u30eb<br \/>\u4fa1\u683c: &#65509;1,480 \u2192 <span style=\"color: #ff0000; font-weight:bold; \">&#65509;730<\/span> (\u8a18\u4e8b\u516c\u958b\u6642)<br \/>\u30b7\u30a7\u30eb\u306e\u5c65\u6b74\u3092\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3001\u540c\u671f\u3001\u6574\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u3002<br clear=\"all\" \/><\/div>\n<p>\u8d77\u52d5\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2021\/05\/s_20210518_140610-1.jpg\" alt=\"S 20210518 140610\" title=\"s_20210518_140610.jpg\" border=\"0\" width=\"1098\" height=\"605\" \/><\/p>\n<p>\u25b2\u300czsh\u300d\u300cbash\u300d\u300cfish\u300d\u3068\u3044\u3063\u305f\u30b7\u30a7\u30eb\u3054\u3068\u306b\u6700\u521d\u306b\u5b9f\u884c\u3059\u3079\u304d\u8a2d\u5b9a\u304c\u63b2\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070zsh\u306e\u5834\u5408\u3001\u4ee5\u4e0b\u3092~\/.zshrc\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre>\r\n# adding shhist to PATH, so we can use it from Terminal\r\nPATH=\"${PATH}:\/Applications\/ShellHistory.app\/Contents\/Helpers\"\r\n\r\n# creating an unique session id for each terminal session\r\n__shhist_session=\"${RANDOM}\"\r\n\r\n# prompt function to record the history\r\n__shhist_prompt() {\r\n    local __exit_code=\"${?:-1}\"\r\n    history -D -t \"%s\" -1 | sudo --preserve-env --user ${SUDO_USER:-${LOGNAME}} shhist insert --session ${TERM_SESSION_ID:-${__shhis\\\r\nt_session}} --username ${LOGNAME} --hostname $(hostname) --exit-code ${__exit_code}\r\n    return ${__exit_code}\r\n}\r\n\r\n# integrating prompt function in prompt\r\nprecmd_functions=(__shhist_prompt $precmd_functions)\r\n<\/pre>\n<p>\u25b2\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u3054\u3068\u306b\u3001ShellHistory\u306b\u542b\u307e\u308c\u308b\u300cshhist\u300d\u30b3\u30de\u30f3\u30c9\u304c\u547c\u3073\u51fa\u3055\u308c\u3001\u5c65\u6b74\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u65e2\u5b58\u306e\u5c65\u6b74\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b\u306b\u306f\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>\r\nhistory -D -t \"%s\" -1000000 | \"\/Applications\/ShellHistory.app\/Contents\/Helpers\/shhist\" import\r\n<\/pre>\n<p>\u8a2d\u5b9a\u304c\u5b8c\u4e86\u3059\u308b\u3068\u30b7\u30a7\u30eb\u3067\u5b9f\u884c\u3057\u305f\u30b3\u30de\u30f3\u30c9\u306e\u5c65\u6b74\u304cShellHistory\u306b\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2021\/05\/s_20210518_141755.jpg\" alt=\"S 20210518 141755\" title=\"s_20210518_141755.jpg\" border=\"0\" width=\"1095\" height=\"604\" \/><\/p>\n<p>\u25b2\u5de6\u5074\u306e\u300cHistory\u300d\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u5b9f\u884c\u3057\u305f\u30b3\u30de\u30f3\u30c9\u304c\u4e00\u89a7\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u30b3\u30de\u30f3\u30c9\u6587\u5b57\u5217\u306e\u307b\u304b\u3001\u5b9f\u884c\u6642\u9593\u3084\u30e6\u30fc\u30b6\u30fc\u540d\u3001\u30db\u30b9\u30c8\u540d\u306a\u3069\u306e\u5404\u7a2e\u60c5\u60c5\u5831\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002\u753b\u9762\u4e2d\u592e\u306e\u691c\u7d22\u30dc\u30c3\u30af\u30b9\u3092\u5229\u7528\u3057\u3066\u5c65\u6b74\u3092\u7d5e\u308a\u8fbc\u3080\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2021\/05\/s_20210518_145008.jpg\" alt=\"S 20210518 145008\" title=\"s_20210518_145008.jpg\" border=\"0\" width=\"1119\" height=\"615\" \/><\/p>\n<p>\u25b2\u30b3\u30de\u30f3\u30c9\u3084\u30e1\u30e2\u3092\u307e\u3068\u3081\u305f\u30ce\u30fc\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u30b3\u30de\u30f3\u30c9\u306f\u5c65\u6b74\u304b\u3089\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u307b\u304b\u300cinsert command\u300d\u3067\u65b0\u898f\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u300cinsert note\u300d\u3067\u30e1\u30e2\u306e\u8ffd\u52a0\u3001\u300cinsert link\u300d\u3067\u30ea\u30f3\u30af\u306e\u8ffd\u52a0\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2021\/05\/s_20210518_145039.jpg\" alt=\"S 20210518 145039\" title=\"s_20210518_145039.jpg\" border=\"0\" width=\"1110\" height=\"607\" \/><\/p>\n<p>\u25b2\u300cPreferences\u300d\u3067\u306fiCloud\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u6709\u52b9\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>ShellHistory\u3092\u5229\u7528\u3059\u308b\u3068\u30b7\u30a7\u30eb\u306e\u5c65\u6b74\u3092\u3055\u3089\u306b\u6709\u52b9\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u983b\u7e41\u306b\u4f7f\u7528\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3092\u30e1\u30e2\u3068\u5171\u306b\u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u30ce\u30fc\u30c8\u6a5f\u80fd\u3082\u4fbf\u5229\u3067\u3059\u3002\u8208\u5473\u306e\u3042\u308b\u65b9\u306f\u8a66\u7528\u7248\u3067\u78ba\u8a8d\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p><iframe width=\"680\" height=\"383\" src=\"https:\/\/www.youtube.com\/embed\/CfmveyJbUQc\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u3084macOS\u3067\u4f7f\u7528\u3059\u308b\u300c\u30b7\u30a7\u30eb\u300d\u306b\u306f\u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u5c65\u6b74\u3092\u4fdd\u5b58\u3059\u308b\u6a5f\u80fd\u304c\u642d\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002 \u30b7\u30a7\u30eb\u81ea\u4f53\u306b\u3082\u4fdd\u5b58\u3057\u305f\u5c65\u6b74\u3092\u691c\u7d22\u3057\u3001\u518d\u5229\u7528\u3059\u308b\u305f\u3081\u306e\u6a5f\u80fd\u306f\u642d\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001GUI\u3067\u5c65\u6b74\u3092\u7ba1\u7406\u3057\u305f\u308a\u3001\u5c65\u6b74\u3092\u540c\u671f\u3057\u305f\u308a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":87311,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[3459],"tags":[1383],"class_list":["post-87300","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-review","tag-shell"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/87300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=87300"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/87300\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/87311"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=87300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=87300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=87300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}