Tutorial details | |
---|---|
Difficulty | Easy (rss) |
Root privileges | No |
Requirements | z* commands |
Time | 1m |
Syntax
Display resume.txt.gz on screen using cat command like syntax:
zcat resume.txt.gz
Display access_log_1.gz on screen at a time:
zmore access_log_1.gz
Or try zless (less command):
zless access_log_1.gz
Search access_log_1.gz for 1.2.3.4 IP address using grep command like syntax:
zgrep '1.2.3.4' access_log_1.gz
You can use egrep command like syntax:
egrep 'regex' access_log_1.gz egrep 'regex1|regex2' access_log_1.gz
See also
- A quick introduction to z* commands to read gzip compressed text files on a fly
- Man pages: bash(1)
🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.
🐧 4 comments so far... add one ↓
🐧 4 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
I use below command for the same purpose.
gzip -cd access_log_1.gz | egrep ‘regex1|regex2’
Thanks – great as always :)
Found I had to use below on Solaris 10
gzcat gzdiff gzexe gzforce gzip gzmore
gzcmp gzegrep gzfgrep gzgrep gzless gznew
Thank you