Dateiinhalt (error_log) manuell löschen
Dateiinhalt (error_log) manuell löschen
Hallo Leute,
eventuell kann mir jemand helfen. Gibt es einen Linux - Befehl, mit welchem ich auf der Konsole den Inhalt einer Datei komplett löschen kann. Als Beispiel sei es die eroror_log, welche ich manuell (Inhalt) löschen möchte?
Würde mich Interessieren, daher ich einfach nichts finde ( :google: ) und auch hier im Forum bei uns nichts finde?
Ich komme nicht drauf ](*,) :oops:
Gruss
m_h_bo
eventuell kann mir jemand helfen. Gibt es einen Linux - Befehl, mit welchem ich auf der Konsole den Inhalt einer Datei komplett löschen kann. Als Beispiel sei es die eroror_log, welche ich manuell (Inhalt) löschen möchte?
Würde mich Interessieren, daher ich einfach nichts finde ( :google: ) und auch hier im Forum bei uns nichts finde?
Ich komme nicht drauf ](*,) :oops:
Gruss
m_h_bo
Re: Dateiinhalt (error_log) manuell löschen
Code: Select all
# echo -n "" > /path/to/eroror_logRe: Dateiinhalt (error_log) manuell löschen
=D>
Vielen Dank und Gruss
m_h_bo
Vielen Dank und Gruss
m_h_bo
-
Roger Wilco
- Posts: 5923
- Joined: 2004-05-23 12:53
Re: Dateiinhalt (error_log) manuell löschen
Statt den Inhalt zu löschen, solltest du die Datei lieber rotieren. Logrotate ist dafür recht nützlich...
Re: Dateiinhalt (error_log) manuell löschen
vielen Dank Roger, werde ich nun einsetzen!Roger Wilco wrote:Statt den Inhalt zu löschen, solltest du die Datei lieber rotieren. Logrotate ist dafür recht nützlich...
Gruss
m_h_bo
Re: Dateiinhalt (error_log) manuell löschen
useless use of echo ;)apr wrote:Code: Select all
# echo -n "" > /path/to/eroror_log
Code: Select all
# > /path/to/eroror_logPayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: Dateiinhalt (error_log) manuell löschen
... was dann dazu führt, dass man ein STRG+D hinterher schicken muss, um die Standardeingabe zu beenden (zumindest auf meiner zsh hier).Joe User wrote:useless use of echo ;)apr wrote:Code: Select all
# echo -n "" > /path/to/eroror_logCode: Select all
# > /path/to/eroror_log
Re: Dateiinhalt (error_log) manuell löschen
Die "Abkürzung" funktioniert aber nur für die Bourne Shell und kompatible Derivate. Die C-Shell-Familie (z. B. tcsh) reagiert dazu mit einer unterhaltsamen Fehlermeldung ("Invalid null command"). Insofern wäre der umständliche Weg mit echo der allgemein gültigere 8)Joe User wrote:Code: Select all
# > /path/to/eroror_log
Re: Dateiinhalt (error_log) manuell löschen
Wer seiner Shell noclobber verpasst hat, muss halt ein Zeichen mehr tippen als in meinem ersten Beispiel:
ash:
bash:
csh:
ksh:
zsh:
Für weitere Shells bitte selbst die Doku lesen ;)
ash:
Code: Select all
# >| fileCode: Select all
# >| fileCode: Select all
# >! fileCode: Select all
# >| fileCode: Select all
# >! filePayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: Dateiinhalt (error_log) manuell löschen
Hallo
gruss
m_h_bo
funktioniert auch bei mir...Noch einmal danke an alle!# > /path/to/eroror_log
gruss
m_h_bo

