Login using Social Account
     Continue with GoogleLogin using your credentials
To see what is inside a text file, you can use either cat
, tail
or head
command.
Using cat
you can see the whole content of the file:
cat myfirstfile_copy.txt
Do not use this command to look inside a huge file. For the huge file, you can use the more
command which would display the content of a file in a paginated way:
more myfirstfile_copy.txt
tail
shows you the last few lines of a file
tail myfirstfile_copy.txt
By default tail
shows you only last 10 lines, you can change it using the command line option. For example, to see the last 20 lines, you can use
tail -20 myfirstfile_copy.txt
We can use the -f
option with tail
for displaying newly appended lines of a continuously growing file. This option is mainly used to monitor the growth of log files. So, the console will keep on displaying the new lines as soon as there will be an update in the file.
tail -f access.log
To terminate it, press Ctrl + C
.
If you are interested in the first few lines, you can use the head
command. By default head
shows you only first 10 lines, you can change it using the command line option. For example, to see the first 20 lines, you can use
head -20 myfirstfile_copy.txt
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Answer is not availble for this assesment
Loading comments...