Question

unix How would you display the frst three lines of fle myfile?

unix

How would you display the frst three lines of fle myfile?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

if we want to display the first few lines of the file we have to use the below commad.

head -n filename

If we didnt specify the no of lines to be displayed ,by default the no of lines will be displayed is 10.

but if we want to specify the no of lines to be displayed we have to use the number.

like : head -3 myfile

here this command will display the first three lines of the file named myfile.

__________________Thank You

Add a comment
Know the answer?
Add Answer to:
unix How would you display the frst three lines of fle myfile?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What unix / linux command would I use to execute this: Display only the fifth field...

    What unix / linux command would I use to execute this: Display only the fifth field on each line in the file myclass using a delimiter of :

  • 1) Write a Unix command that will display the message below using echo and the value...

    1) Write a Unix command that will display the message below using echo and the value of your environment variable instead of the sample student login /students/astud01 My home directory is /students/astude01 2) Write a Unix command to display your login and the system date with both commands on one line (the output may be on separate lines) SAMPLE OUTPUT (details will differ): cconner Tue Jul 7 15:38:44 PDT 2015 3) 1.Write a Unix command that will redirect (>) the...

  • In UNIX if a file named "dimensions" contains fields separated by colons : What commands would...

    In UNIX if a file named "dimensions" contains fields separated by colons : What commands would you use to display the third field followed by the fifth?

  • INTRO TO UNIX COURSE Comments in C++ come in two forms: the block format started by...

    INTRO TO UNIX COURSE Comments in C++ come in two forms: the block format started by a /* and ending with a */, often on different lines, and the inline format started by // and ended at the end of the line. What command would you give to list all lines of commented.cpp that contain inline comments? What command would you give to print (display on the screen) the contents of commented.cpp with all inline comments removed (and no other...

  • Word count. A common utility on Unix/Linux systems. This program counts the number of lines, words...

    Word count. A common utility on Unix/Linux systems. This program counts the number of lines, words (strings of characters separated by blanks or new lines), and characters in a file (not including blank spaces between words). Write your own version of this program. You will need to create a text file with a number of lines/sentences. The program should accept a filename (of your text file) from the user and then print three numbers: The count of lines/sentences The count...

  • COSC 3411 /ITAP 3411 Homework (UNIX Shell Commands) How would you ensure that all ordinary files...

    COSC 3411 /ITAP 3411 Homework (UNIX Shell Commands) How would you ensure that all ordinary files created by you have rw-rw---- as default permissions? How would you sort in the background a file called "bad.txt", and place the results in a file called "sort.txt"? Archive the contents of your home directory (including any subdirectories) using tar. Compress the tar archive with gzip. Now extract their contents. Use the “find” command to locate in /docs and /usr/docs all files that Begin...

  • Vim and Unix Questions In a vim window, how do you set a tab to be...

    Vim and Unix Questions In a vim window, how do you set a tab to be two spaces wide? In a vim window, how do you, with a simple and single command, move the cursor to 5 lines below (don’t worry about the actual number of lines) and do nothing else? In a vim window, how do you, with a simple and single command, assuming your cursor is at the beginning of the word, delete the current word and do...

  • a) How would you use the ls command to display all of the files/directories in the...

    a) How would you use the ls command to display all of the files/directories in the directory ‘/sbin’ that start with ‘bl’? b) How would you use the ls command to display all of the files/directories in your current directory that contain the word ‘grade’ somewhere in the name and end with ‘.pdf’? c) How would you use the ls command to display all of the files/directories in your current directory that are any two characters followed by the file...

  • in wireshark: What would be the two display filters you would use if you wanted to only display packets with port 443? A...

    in wireshark: What would be the two display filters you would use if you wanted to only display packets with port 443? And how would the filter change if you wanted to only display packets with a destination of port 443?

  • How do I do the following on a Unix Command Line Prompt: Change you command-line prompt...

    How do I do the following on a Unix Command Line Prompt: Change you command-line prompt to some interesting phrase/word of your choice Change the command-line prompt to display your user name and your current working directory (this includes your interesting phrase/word) Create a short alias for “ls -l -a”, it is up to you, but maybe “lsa” Execute the “who” command together with the “grep” command to identify whether your peer group (or any 3 or more people) are...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT