Cannot grep /proc, it thinks it is a binary file

[root@localhost ~]# grep systemd /proc/*/cmdline
Binary file /proc/1/cmdline matches
Binary file /proc/461/cmdline matches
Binary file /proc/478/cmdline matches
Binary file /proc/602/cmdline matches
Binary file /proc/610/cmdline matches
Binary file /proc/self/cmdline matches

Solution: Delete the NUL character.

cat  /proc/*/cmdline | tr -d '\000'  | grep systemd
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s