find . -name "access.log*" | xargs grep -h 500 (Explanation needed) <solved>

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
HP7

find . -name "access.log*" | xargs grep -h 500 (Explanation needed) <solved>

Post by HP7 »

i just saw this piece of code which shell scripting...can anyone explain this to me
find . -name "access.log*" | xargs grep -h 500

>also what does that . (dot) after find mean
>whats xargs
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29511
Joined: Wed Jul 06, 2011 3:58 am

Re: find . -name "access.log*" | xargs grep -h 500 (Explanation needed)

Post by xenopeek »

The dot is the current directory. xargs is a way to build commands from input read from another command. As in, the results of the find command are used to build grep commands with xargs (the files found by the find command are then grepped). See here for more details of your command: http://explainshell.com/explain?cmd=fin ... rep+-h+500+
Image
HP7

Re: find . -name "access.log*" | xargs grep -h 500 (Explained)

Post by HP7 »

Thanks "xenopeek" !! that link you gave is very helpful...you are the best :D
Locked

Return to “Scripts & Bash”