cm0002@lemmy.world to Programmer Humor@programming.dev · 10 天前Linux Userslemmy.mlimagemessage-square140linkfedilinkarrow-up11.31Karrow-down127cross-posted to: programmerhumor@lemmy.ml
arrow-up11.29Karrow-down1imageLinux Userslemmy.mlcm0002@lemmy.world to Programmer Humor@programming.dev · 10 天前message-square140linkfedilinkcross-posted to: programmerhumor@lemmy.ml
minus-squareHammerheart@programming.devlinkfedilinkarrow-up9arrow-down2·10 天前cat ~/.bash_history | grep
minus-squaredisobey2623@lemmy.dbzer0.comlinkfedilinkarrow-up2·9 天前You saying I can just skip cat in that command and it works?
minus-squareulterno@programming.devlinkfedilinkEnglisharrow-up0·9 天前My output was empty for that command. Guess why? Because history only gives the last few lines in my system.
minus-squaredisobey2623@lemmy.dbzer0.comlinkfedilinkarrow-up4·9 天前How did I not know this. Thank you!
minus-squareoozynozh@sh.itjust.workslinkfedilinkarrow-up2·9 天前it’s grep STRING FILE to be precise or awk '/STRING/′ FILE if you prefer that for some reason
minus-squareHammerheart@programming.devlinkfedilinkarrow-up2·8 天前Yes, it was meant to be a self deprecating admission that I have used this unnecessarily verbose command.
minus-squareechindod@programming.devlinkfedilinkarrow-up2·8 天前Ah. Well. I can not be blameless on this. I also probably use cat unnecessarily still. But less so with grep these days. I’m getting better… I swear!
cat ~/.bash_history | grep
Useless use of cat?
You saying I can just skip cat in that command and it works?
history | grep 'cat'
My output was empty for that command.
Guess why?
Because
history
only gives the last few lines in my system.How did I not know this. Thank you!
it’s
grep STRING FILE
to be preciseor
awk '/STRING/′ FILE
if you prefer that for some reasonYes, it was meant to be a self deprecating admission that I have used this unnecessarily verbose command.
Ah. Well. I can not be blameless on this. I also probably use cat unnecessarily still. But less so with grep these days. I’m getting better… I swear!