{"id":9020,"date":"2026-05-30T14:31:03","date_gmt":"2026-05-30T12:31:03","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=9020"},"modified":"2026-05-30T14:31:04","modified_gmt":"2026-05-30T12:31:04","slug":"comenzi-ssh-head","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-head\/","title":{"rendered":"Comenzi SSH \u2013 head"},"content":{"rendered":"<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">The <code>head<\/code> command is used to display the beginning of a file. It is commonly used when working with logs or configuration files to quickly inspect initial lines without opening the full file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This command is useful when you only need a preview of a file\u2019s content.<\/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-head\/#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-head\/#Changing_the_number_of_lines\" >Changing the number of lines<\/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-head\/#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-4\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-head\/#Working_with_multiple_files\" >Working with multiple files<\/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-head\/#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-6\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-head\/#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-2749663988\" 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>head filename.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">By default, the command displays the first 10 lines of a file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Changing_the_number_of_lines\"><\/span>Changing the number of lines<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can control how many lines are shown using the <code>-n<\/code> option.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>head -n 5 filename.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This example displays only the first 5 lines of the file.<\/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>head<\/code> command is commonly used to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>preview log files before deeper analysis<\/li>\n\n\n\n<li>check configuration file structure<\/li>\n\n\n\n<li>verify file content after upload or generation<\/li>\n\n\n\n<li>inspect output from other commands in pipelines<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Working_with_multiple_files\"><\/span>Working with multiple files<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can also use <code>head<\/code> with more than one file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>head file1.txt file2.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Each file\u2019s output is displayed separately.<\/p>\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\">The <code>head<\/code> command does not modify files. It only reads and displays content, making it safe to use for inspection tasks.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When working with large log files, <code>head<\/code> helps reduce output and focus only on the earliest entries, which often contain initialization or startup information.<\/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>head<\/code> command displays the beginning of a file and helps quickly inspect its content without opening it fully. It is a basic tool for efficient file analysis in SSH environments.<\/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":[6152,6153,6154,6155,6156,6157,6158,6149,6150,6151],"class_list":["post-9020","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-ssh","manual_kb_tag-display-beginning-of-file","manual_kb_tag-display-first-lines","manual_kb_tag-file-preview","manual_kb_tag-file-inspection","manual_kb_tag-preview-log-files","manual_kb_tag-inspect-log-files","manual_kb_tag-check-configuration-files","manual_kb_tag-head-command","manual_kb_tag-linux-head-command","manual_kb_tag-unix-head-command"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9020","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\/9020\/revisions"}],"predecessor-version":[{"id":9021,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9020\/revisions\/9021"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/media?parent=9020"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manualknowledgebasecat?post=9020"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb_tag?post=9020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}