how to clear unwanted files in ubuntu code example
Example 1: linux remove last line from file
sed '$d' <file>
sed -i '$d' <file> # to edit in place
Example 2: delete old files linux
find /opt/backup -type f -mtime +30 -exec rm -f {} \;
sed '$d' <file>
sed -i '$d' <file> # to edit in place
find /opt/backup -type f -mtime +30 -exec rm -f {} \;