Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
What are cat and zcat commands and what is their differences?

cat is used to print the content of a file (in stdout or a file, etc). It's main usage is when you want to search something in the whole file like a log file:
sudo cat /var/log/nginx/access.log | grep --color "SOMETHING TO SEARCH"

zcat command on the other is used to get the content of a .gz compressed text file like apache.log.1.gz:
sudo zcat /var/log/apache/apache.log.1.gz | grep --color "SOMETHING TO SEARCH"

NOTE: grep command is used to search in a file. the symbol | (pipeline) is used to send (pipe) first command result into the second command.

#linux #grep #cat #zcat #command