Often encounter the view log file, if the log file is too large, with the Less,more,vi,tail command to view it will be more troublesome, but also very difficult to locate specific errors, and regular backup, regular emptying should be a good idea, of course, must be backed up before emptying. If the log file itself does not exist, with mkdir can build an empty file, but the system program is already in the call, then how to empty the file, in fact, quite simple:
Method One:
# Cat/dev/null > Error.log
Method Two:
# echo "" | Tee Error.log
Method Three:
# truncate-s Error.log
Note:
# echo/dev/dull > Error.logbash:error:cannot Overwrite existing file
If you encounter this error when writing a file,
that's because the noclobber switch is turned on. If you want to eliminate the above error, there are two ways:
Method One:
# set +o noclobber; -Off noclobber items # Set-o | grep nocl //--> view Noclobber off
Method Two:
# echo "ORA1001: ..." >| Error.log //--> This is the notation in bash, and if it's csh, use >! filename# cat error.logora1001: ...