LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-11-2010, 11:37 AM   #1
joesto
LQ Newbie
 
Registered: Jun 2010
Location: liverpool GB
Distribution: ubuntu 10.4
Posts: 18

Rep: Reputation: 0
Question how to unlock a log file and?


hi all
how do i unlock a log file so i can clear its contents?
and how do i get the list in the log file to open the listing so the latest entry is at the top?
thanks
joe
 
Old 11-11-2010, 11:46 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Hi there!

Not sure what you mean by "lock" or "unlock" the files. Sounds like you are trying to do things to log files that you do not have permissions to do. Most or all log files are owned by root , so you'll need to be root (or use `sudo`) to remove or clear such files.

As for "open the listing so the latest entry is at the top", again this is slightly unclear, but maybe try:
Code:
tac logfile | less
that may work. If not, someone will have another suggestion, though you may need to clarify exactly what you mean.

Cheers!

EDIT; Oh, P.S. you should ideally have the `logrotate` program being run by cron or something on your system, which should take care of rotating and clearing logs automatically for you. Perhaps you ought to investigate this. Just a suggestion.

Last edited by GrapefruiTgirl; 11-11-2010 at 11:48 AM.
 
1 members found this post helpful.
Old 11-11-2010, 12:05 PM   #3
joesto
LQ Newbie
 
Registered: Jun 2010
Location: liverpool GB
Distribution: ubuntu 10.4
Posts: 18

Original Poster
Rep: Reputation: 0
Thumbs up

thanks celine understood i have changed the own to myself now and i can del. its contents

as for the listing

in the log file as a couple of lines foe example


this lie 20pm
this line 21pm
this line 22pm
and so on
when i opem the logfile i would lke to have the last entry first for example
this line 22pm
this line 21pm
this line 20pm
as you can see if the listing is very long i have to scroll down to see the lastest entry
hope that explains it
thanks
joe
 
Old 11-11-2010, 12:10 PM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Yup, that explains it. Try the command I suggested. You probably need to use `sudo` for that too. Does it work?

Also, if you just want to see the last few lines, use the `tail` command. See:
Code:
man tail
for details.

Last edited by GrapefruiTgirl; 11-11-2010 at 12:11 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I unlock a file? Brooksias Linux - Newbie 8 12-14-2010 06:49 AM
How to Unlock a file? limeylew MEPIS 20 06-22-2010 08:34 AM
[SOLVED] Unlock protected pdf file? dili Linux - Software 9 06-12-2010 07:34 AM
In Apache server, How to change log file location and log format for access log fil? since1993 Linux - Server 1 08-19-2009 04:14 PM
How can I lock/unlock passwd file? scorpionaag Linux - Server 2 01-04-2008 08:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration