![]() So if you want to use the different files, all you have to do is append them one by one, followed by space: head įor example, here, I used two files and printed the first five lines of each: head -n 5 Haruki.txt Premchand.txt So here, I printed the first five lines of the Haruki.txt file and enabled the verbose output to display the name of the file: 4. Yes, you can use more than one option at once! Display the name of the file being usedĪs you can see, the head command won't print the filename by default, so if you want to enable this behavior, all you have to do is use the -v flag for verbose output: head -v So let's say I want to exclude the last three lines and print everything else from the Haruki.txt then the command looks like this: head -n -3 Haruki.txt 3. So if you want to restrict the output by not including the last N lines, all you have to do is use the same -n flag but have to use the negative number ( -n): head -n. So let's say I want to print the first five lines of Haruki.txt file, then you type the following: head -n 5 Haruki.txt 2. So if you want to print first N lines, all you have to do is use the -n flag and append the number of the first N lines you want: head -n number-of-lines Filename ![]() In this section, I will walk you through some practical examples of the head command. This indicates that you need to replace the content with with a suitable value. You’ll see some command examples with text inside. South of the Border, West of the Sun (1992)Ĭolorless Tsukuru Tazaki and His Years of Pilgrimage (2013)Īnd when you use the head command without any options, it will print the first ten lines of the file:Īs you can see, it skipped the last five lines! Hard-Boiled Wonderland and the End of the World (1985) To make things easy, I will be using a simple text file named Haruki.txt with the following content: Hear the Wind Sing (1979) ![]() file is where you give the absolute path or filename of the file.options are used to tweak the default behavior of the head command.So let's start with the syntax for the head command: head ![]() To use any command in Linux, you will have to use the correct syntax else, you will get an error. It looks like that is not possible with just a simple terminal command.New to the terminal? Learn the terminology How to use the head command in Linux My idea was to precede the requested terminal command with a command to first expand the terminal window to full screen and then run the main command, like terminalfullscreen & lsblk -o NAME,LABEL,SIZE,FSUSED,FSTYPE,UUID,PARTUUID,MOUNTPOINT,PARTFLAGS. NAME LABEL SIZE FSUSED FSTYPE UUID PARTUUID MOUNTPOINT PARTFLAGS Code: Select all ~$ lsblk -o NAME,LABEL,SIZE,FSUSED,FSTYPE,UUID,PARTUUID,MOUNTPOINT,PARTFLAGS
0 Comments
Leave a Reply. |