How to view live updates in a file under Linux Kā apskatīt dzīvot atjauninājumu failu zem Linux

by Sukrit Dhandhania on June 30, 2009 ar Sukrit Dhandhania 2009 June 30,

Linux

If you administer a Linux server or are a developer it is quite likely that you might need to watch a file to check for live updates to it. Ja ievadāt Linux servera vai attīstītājs ir diezgan iespējams, ka jums var būt nepieciešams, lai noskatītos fails, lai pārbaudītu dzīvot jauninājumus tajā. It could be a log file which you want to keep an eye on to see if any errors or messages appear, or it could just be a file with some data written into it. Tas varētu būt log failu, kuru vēlaties paturēt acīs, lai redzētu, vai kļūdas vai ziņojumus, šķiet, vai to varētu vienkārši failu ar dažu datu iestrādātas tā. Here's a way you can have that file update itself rather than your having to hit the refresh button constantly. Lūk, kā jūs varat būt šo failu update pati, nevis jūsu nepieciešamības hit refresh pogu pastāvīgi.

Say you want to monitor the Apache web server log file, /var/log/http/access.log . Ka vēlaties kontrolēt Apache Web servera log failu / var / log / http / access.log. Use the following command to get live updates: Izmantojiet komandu, lai iegūtu dzīvu atjauninājumiem:

# tail -f /var/log/http/access.log # Tail-f / var / log / http / access.log

When you hit the Return key you should see the last few entries in the file (if there are any) and then the command will wait for further updates to the file and update automatically. Kad jūs nospiedīsiet taustiņu Return atslēgu vajadzētu redzēt pēdējos ierakstus failā (ja tādas ir) un tad komanda gaidīs turpmāku atjauninājumu failu un atjaunots automātiski. One drawback of this command is that you can not scroll up or down using tail. Viena atmaksas šī komanda ir tā, ka jūs nevarat ritiniet uz augšu vai uz leju, izmantojot asti. Another drawback of this command is that if you are monitoring a file that gets rolled (the file gets moved to another file and a new blank file is used instead of the first one), then this command will stop the updates. Vēl viens šīs komandas trūkums ir tas, ka gadījumā, ja esat uzraudzības failu, kas izpaužas velmēti (fails izpaužas pārcēlās uz citu failu un jaunu tukšu failu vietā lieto pirmo), tad šī komanda tiks pārtraukta atjauninājumus. We have a solution for the second problem. Mums ir risinājums Otrā problēma. Use the following syntax: Lietot šādu sintaksi:

# tail -F /var/log/http/access.log # Tail-F / var / log / http / access.log

The upper case -F ensures that even if the file rolls it will continue reading from the new file, which is quite useful. Lielajiem burtiem-F nodrošina, ka, pat ja fails ruļļos tā turpinās lasījums no jaunu failu, kas ir visai noderīgi. I usually just use this option regardless of whether I think the file might roll or not. Es parasti tikai izmantot šo iespēju, neatkarīgi no tā, es domāju, ka fails var ripo vai nē.

Related Posts: Related Posts:
  • How to backup your Windows Live Contacts Kā rezerves jūsu Windows Live Contacts
  • How to customize Windows Live Messenger (remove ads, add/remove buttons etc) Kā pielāgot Windows Live Messenger (noņemt reklāmām, pievienot / noņemt pogas uc)
  • 5 Great Web Comics 5 Great Web Comics
  • Simplehelp Updates Simplehelp Updates
  • How to securely clean up data on a hard disk on Linux Kā droši attīrītu datus no cietā diska uz Linux
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! Get Simple Palīdzība konsultācijas tāpat kā šo vienu savā e-pastā ik dienas - bez maksas! Just enter your email address below: Vienkārši ievadiet savu e-pasta adresi:

    You can always opt out of this email subscription at any time. Jūs vienmēr varat atteikties no šīs e-pasta abonementu jebkurā laikā.

    { 0 comments… (0 comments ... add one now pievienot vienu tagad } )

    Leave a Comment Leave Comment

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Jūs varat izmantot šos HTML tagus un atribūtus: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>