{"id":9030,"date":"2026-05-30T14:45:06","date_gmt":"2026-05-30T12:45:06","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=9030"},"modified":"2026-05-30T14:45:07","modified_gmt":"2026-05-30T12:45:07","slug":"istoricul-comenzilor-ssh","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-history\/","title":{"rendered":"Comenzi SSH - istoric"},"content":{"rendered":"<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">The <code>history<\/code> command is used to display a list of previously executed commands in an SSH session. It helps you review, reuse, or track commands that were run on the server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is useful when working with long command sequences or when you need to repeat a previous action without retyping it.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-history\/#How_the_command_works\" >How the command works<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-history\/#Re-running_previous_commands\" >Re-running previous commands<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-history\/#Searching_history\" >Searching history<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-history\/#Clearing_command_history\" >Clearing command history<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-history\/#Practical_use_cases\" >Practical use cases<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-history\/#Practical_implications\" >Practical implications<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-history\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_the_command_works\"><\/span>How the command works<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<\/div>\n\n<div id=\"mybox-4074902145\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Acces timpuriu<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Mai ave\u021bi nevoie de ajutor?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contacta\u021bi echipa noastr\u0103 de servicii pentru clien\u021bi.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Trimite mesaj<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">The basic structure is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>history\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This displays a numbered list of commands executed in the current user session.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Re-running_previous_commands\"><\/span>Re-running previous commands<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can re-execute a command directly from the history list using its number:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>!123\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This runs the command with ID <code>123<\/code> from the history output.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Searching_history\"><\/span>Searching history<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can filter results using <code>grep<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>history | grep \"ssh\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This shows only commands that contain the word <code>ssh<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Clearing_command_history\"><\/span>Clearing command history<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To clear the current session history:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>history -c\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This removes the recorded commands for the current session.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Practical_use_cases\"><\/span>Practical use cases<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>history<\/code> command is commonly used for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>repeating frequently used commands<\/li>\n\n\n\n<li>auditing recent server actions<\/li>\n\n\n\n<li>troubleshooting command sequences<\/li>\n\n\n\n<li>improving efficiency in SSH workflows<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Practical_implications\"><\/span>Practical implications<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Command history is stored per session and may vary depending on system configuration. Closing the session may reset the visible history, while some systems persist history in user configuration files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Be cautious when re-running commands using <code>!number<\/code>, especially on production systems, as the command executes immediately without confirmation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>history<\/code> command displays previously executed SSH commands and allows quick reuse of them. It is a practical tool for improving efficiency and tracking actions in a Linux environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[54],"manual_kb_tag":[6116,6107,6108,6109,6110,6111,6112,6113,6114,6115],"class_list":["post-9030","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-ssh","manual_kb_tag-grep-history","manual_kb_tag-command-history","manual_kb_tag-history-command","manual_kb_tag-bash-history","manual_kb_tag-shell-history","manual_kb_tag-linux-history","manual_kb_tag-history-expansion","manual_kb_tag-rerun-command","manual_kb_tag-repeat-commands","manual_kb_tag-search-history"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9030\/revisions"}],"predecessor-version":[{"id":9031,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9030\/revisions\/9031"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/media?parent=9030"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manualknowledgebasecat?post=9030"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb_tag?post=9030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}