How does `head` differ?

The head command in Unix-like systems is used to display the beginning of a text file or the output of a command. By default, it shows the first 10 lines of the specified file or input. Here are some key differences and features of head:

  1. Output Control: You can specify the number of lines to display using the -n option. For example, head -n 5 filename.txt shows the first 5 lines.

  2. Input from Pipes: head can take input from other commands via pipes. For example, ls -l | head will show the first 10 lines of the output from the ls -l command.

  3. File Handling: You can use head with multiple files. For example, head file1.txt file2.txt will display the first 10 lines of each file, with a header indicating the file name.

In contrast, the whoami command is specifically for displaying the current user's username, while head is focused on file content management. If you need more details or examples, let me know!

0 Comments

no data
Be the first to share your comment!