Bash head: Difference between revisions
Jump to navigation
Jump to search
(One intermediate revision by the same user not shown) | |||
Line 6: | Line 6: | ||
<code>head</code> is used to print the first ten lines (by default) or a specified number of lines. | <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 11: | 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
Print the First 24 Characters of the First Line of the File
head -c 24 somefile