Bash head: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Linux =Overview= =Usage= ==Extract a Specific Line from a File== {{Internal|Bash_Input/Output#With_head_and_tail|Extract a Specific Line fr...")
 
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:


=Overview=
=Overview=
<code>head</code> is used to print the first ten lines (by default) or a specified number of lines.
<syntaxhighlight lang='bash'>
head -15 <file>
</syntaxhighlight>


=Usage=
=Usage=
Line 9: Line 15:
==Extract a Specific Line from a File==
==Extract a Specific Line from a File==
{{Internal|Bash_Input/Output#With_head_and_tail|Extract a Specific Line from a File}}
{{Internal|Bash_Input/Output#With_head_and_tail|Extract a Specific Line from a File}}
==Print the First 24 Characters of the First Line of the File==
<syntaxhighlight lang='bash'>
head -c 24 somefile
</syntaxhighlight>

Latest revision as of 20:24, 18 February 2022

Internal

Overview

head is used to print the first ten lines (by default) or a specified number of lines.

head -15 <file>

Usage

Extract a Specific Line from a File

Extract a Specific Line from a File

Print the First 24 Characters of the First Line of the File

head -c 24 somefile