Questions tagged [tail]

The tail is the part of a list that comes after the head. It's also a unix command that shows the last lines of a file.

Depending on the context tail may refer to:

  • the part of a list that comes after the head i.e. the list you obtain when you remove the first element.

  • the tail unix command which displays the last lines of a file. It's counterpart which displays the first lines is head (). Example: tail -n 10 file will output last 10 lines of file.


See also:

1032 questions
23
votes
6 answers

What is the PHP built-in server error log location?

I don't know if there's any. But does the PHP built in a web server also save its error logs in a file? For tailing purposes, like when creating virtual host in Apache. I'm using Mac OS X.
Bryan Estrito
  • 673
  • 2
  • 6
  • 17
23
votes
3 answers

Linux find command, find 10 latest files recursively regardless of time span

What have I tried so far... Command: find . -type f -ctime -3 | tail -n 5 Result: ./Mobilni Telefoni/01. Box Update/05. DC Unlocker Client/dc-unlocker_client-1.00.0857.exe ./Mobilni Telefoni/01. Box Update/39. Z3X Box/01. Update/01. Samsung…
Dejan Marjanović
  • 19,244
  • 7
  • 52
  • 66
23
votes
6 answers

PowerShell equivalent for "head -n-3"?

I've been able to track down basic head/tail functionality: head -10 myfile <==> cat myfile | select -first 10 tail -10 myfile <==> cat myfile | select -last 10 But if I want to list all lines except the last three or all lines except the first…
likso
  • 3,370
  • 3
  • 17
  • 18
22
votes
4 answers

How do I use Head and Tail to print specific lines of a file

I want to say output lines 5 - 10 of a file, as arguments passed in. How could I use head and tail to do this? where firstline = $2 and lastline = $3 and filename = $1. Running it should look like this: ./lines.sh filename firstline lastline
user2232423
22
votes
11 answers

Value of the last element of a list

how to get the value of the last element of a List? I've noted that List.hd (or .Head) return an item, while List.tl (or .Tail) returns a List. Is rev the List and get the hd the only way around? Thanks.
pistacchio
  • 56,889
  • 107
  • 278
  • 420
21
votes
1 answer

How to preserve colors in logs with Multitail?

Output of tail logs/development.log in XFCE Terminal: multitail log/development.log Rails adds escape codes to log files automatically. See development.log file: ^[[1m^[[36m (84.1ms)^[[0m ^[[1mCREATE TABLE "schema_migrations" ("version"…
A.D.
  • 4,487
  • 3
  • 38
  • 50
20
votes
5 answers

How would you implement tail efficiently?

What is the efficient way to implement tail in *NIX? I came up (wrote) with two simple solution, both using kind of circular buffer to load lines into circular structure (array | doubly linked circular list - for fun). I've seen part of older…
Tomas Pruzina
  • 8,397
  • 6
  • 26
  • 39
19
votes
6 answers

Using combination of "head" and "tail" to display middle line of the file in Unix

If I have a file name myownfile.txt which contains 3 lines of text. foo hello world bar I want to display the line in the middle which is hello world by using head and tail command only.
Ali
  • 9,997
  • 20
  • 70
  • 105
19
votes
2 answers

How do I access the not-the-first elements of an array in Swift?

Swift's Array has a first function which returns the first element of the array (or nil if the array is empty.) Is there a built-in function that will return the remainder of the array without the first element?
Robert Atkins
  • 23,528
  • 15
  • 68
  • 97
19
votes
6 answers

Implement "tail -f" in C++

I want to create a small code in C++ with the same functionality as "tail-f": watch for new lines in a text file and show them in the standard output. The idea is to have a thread that monitors the file Is there an easy way to do it without opening…
Hamming
  • 193
  • 1
  • 1
  • 4
19
votes
2 answers

How to output lines 800-900 of a file with a unix command?

I want to output all lines between a and b in a file. This works but seems like overkill: head -n 900 file.txt | tail -n 100 My lack of unix knowledge seems to be the limit here. Any suggestions?
Jesper Rønn-Jensen
  • 106,591
  • 44
  • 118
  • 155
19
votes
1 answer

tail -f into grep into cut not working properly

i'm trying to build a shell script to monitor some log files. I'm using a command like this: tail -f /var/somelog | grep --line-buffered " some test and p l a c e h o l d e r" | cut -f 3,4,14 -d " " the log file is like: some test and p l a c e h o…
Andrea Tullis
  • 191
  • 1
  • 1
  • 6
18
votes
1 answer

Best way to split several heads from a list with Erlang?

So, Erlang is a real joy to work with, but there's one problem I run into occasionally, that I'm wondering if there is a nicer way to solve. Often, I find myself needing to split several items from a list. The syntax for splitting a list into a Head…
18
votes
4 answers

Inserting blank lines in powershell console

On unix I can do a tail -f file And the equivalent powershell command is gc file -Wait However on unix I can press enter to add some blank lines (for readability) on the console while it is outputting lines, but not in powershell. Any…
FelixHJ
  • 1,071
  • 3
  • 12
  • 26
18
votes
4 answers

shell: delete the last line of a huge text log file

I asked a question regarding popping the last line of a text file in PHP, and now, is it possible to re-write the logic in shell script? I tried this to obtain the last line: tail -n 1 my_log_file.log but I am not sure how can I remove the last…
Raptor
  • 53,206
  • 45
  • 230
  • 366
1 2
3
68 69