I need to grep only /

I need to grep on a output line, but only keeping the line with /

tmpfs                                401848      1200    400648   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  19430032   9664212   8753496  53% /
tmpfs                               2009224         8   2009216   1% /dev/shm
tmpfs                                  5120         0      5120   0% /run/lock
/dev/sda2                           1992552    253624   1617688  14% /boot
Shared                            498179396 371979712 126199684  75% /mnt/share
tmpfs                                401844         4    401840   1% /run/user/1000

In this case, the second line

df | grep / gives all the lines

>Solution :

$ matches end of line:

df | grep /$

Leave a Reply