Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I host my website at GoDaddy. I have a 9GB log file that I want to delete. I've logged in via SSH as root.

How do I delete the log file?

Filename                     Size    Last modified
birja-vdv.az_access_log      9 GB    2:20 AM
share|improve this question
Do you have the path of the log file? Then just rm pathtologfile. -1, lack of research effort. Also unclear is why you have a 9GB log file, which might be relevant to the question. And what kind of log file it is. – Daniel Andersson May 15 '12 at 9:37
It's a access log.i have info in SCP – Neo May 15 '12 at 9:39
rm birja-vdv.az_access_log – Daniel Andersson May 15 '12 at 9:43
it says no such directory – Neo May 15 '12 at 9:44
You have to be in the directory or give the full path. Learn to use the manual, such as man rm. In all frankness, if you don't know how the rm command works or how you can find out, you should make sure that you know this before starting to delete files on anyone's advise. – Daniel Andersson May 15 '12 at 9:47

Try this command

  locate birja-vdv.az_access_log

The answer will be something like


You could then

  rm /var/log/birja-vdv.az_access_log

However, if your web-server is holding the log-file open, the actual file does not get deleted until the web-server closes the log file. You should get the web-server to close and re-open it's log files. With thye Apache webserver you may be able to restart it using a command such as

  apachectl graceful

As Silviu suggests most people prefer to set up something like logrotate to automatically rename old log files and delete the oldest.

See StackOverflow Best way to rotate Apache log files
and Apache Rotatelogs

I'd check GoDaddy's help pages before proceeding. They are a very big hosting company and will very likely have some easy means for you to manage log files (perhaps through a web control-panel)

share|improve this answer
It asks rm: remove regular file `/var/log/httpd/birja-vdv.az_access_log'? What should i type? – Neo May 15 '12 at 10:10
@Neo y for yes, or n for no. To be honest, you should consider reading some tutorials about basic Linux commands and Bash usage before you go about removing stuff from a web server. – slhck May 15 '12 at 10:48
I strongly approve the comment from slhck. If you're meant to administer your hosted web server, then before doing anything you should learn the basics. You don't try to fix a car engine before knowing it's basic principles/concepts. – Huygens May 15 '12 at 11:24
Thanks guys, i sent this info to my web programmer, i love you all and this website, thanks! – Neo May 15 '12 at 19:51

Your log files are most likely at /var/log (cd /var/log)

Once there, do a file listing (ls -asl) and look for the log files. Old log files are mostly archived and they can be seen as "logname.#.tar.gz" i think (or bz2, not sure). Depending if you need them or not, you can delete them either by hand (single file names, or the logs of an entire application as in "rm apache*.tar.gz"

If cleaning up /var/log doesn't help you (delete enough files), look up what uses most of your hard drive with "du -h", but be careful what you delete.

share|improve this answer
4 -rw-r--r-- 1 root root 126 Jan 29 18:29 * 4 dr-xr-x--- 2 root root 4096 Mar 28 19:10 . 4 dr-xr-xr-x 20 root root 4096 May 14 04:10 .. 8 -rw------- 1 root root 4195 May 15 02:32 .bash_history 4 -rw-r--r-- 1 root root 18 Mar 30 2009 .bash_logout 4 -rw-r--r-- 1 root root 176 Mar 30 2009 .bash_profile 4 -rw-r--r-- 1 root root 176 Sep 22 2004 .bashrc 4 -rw-r--r-- 1 root root 100 Sep 22 2004 .cshrc 4 -rw------- 1 root root 40 Feb 1 05:43 .mysql_history 4 -rw------- 1 root root 3997 Mar 28 19:54 .support_history – Neo May 15 '12 at 9:49
4 -rw-r--r-- 1 root root 129 Dec 3 2004 .tcshrc 8 -rw------- 1 root root 4136 Mar 28 18:08 .viminfo 216 -rw-r--r-- 1 root root 214761 Mar 28 19:10 mailerror – Neo May 15 '12 at 9:49
@Neo: When adding information, it is sometimes better to edit your question rather than add a comment. Your listing can be formatted in the question so that it is easier to read, you can't format comments. The command Andreas meant you to enter was cd /var/log; ls -asl. – RedGrittyBrick May 15 '12 at 9:54
In case the file was given to you by godaddy and you can't find it, use find / -name birja-vdv.az_access_log, if you have the full path follow what Daniel Andersson said, read up about rm and delete it using the full path. – Andreas May 15 '12 at 9:55
i found it. It looks like /var/log/httpd/birja-vdv.az_access_log – Neo May 15 '12 at 10:00

My guess is that you want to delete your apache log files. Even if you will delete them now, it's good practice to use:


You can check more here.

share|improve this answer
Judging from the rest of his comments, trying to grasp logrotate would probably blow up his head. :-) – DevSolar May 15 '12 at 11:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .