Zip a file with path

zip /var/log/mylog.log mylog.1.log but its not working

What exact command did you use?
ex.:

zip newzipfilename.zip /var/log/mylog.log
1 Like

the zip command but i dont know how to use it

That is what I just gave you an example of.

i want to compress a specific file
zip /var/log/mrnet.log (into mrnet.log.1.gz)
is it possible

you would use

gzip -S .1.gz /var/log/mrnet.log

But from the filepath and name you really should setup a logrotate entry as /etc/logrotate.d/mrnet something like this

/var/log/mrnet.log
{
    weekly
    create
    compress
    rotate 4
    missingok
}
1 Like