Its all about command line tools and regular expressions

  $ 
_ _ _ _ | |(_) | |(_) | | _ _ __ _ _ __ __ ___ | | _ | || || '_ \ | | | |\ \/ // __|| || | | || || | | || |_| | > <| (__ | || | |_||_||_| |_| \__,_|/_/\_\\___||_||_|
 


{

Find large size directory content which eat space

}
du command -h show unique command is to human readable size display repetitive format by the number of output in to single increase in digit the output. size name increase from | from bytes to kilo-bytes | from kilo-bytes to | | mega-bytes and so on.| | Redirect error output |___ pipe | in a given file. | | | | | | | | | | # find / -type d -exec du -h {} \; | sort|uniq|sort -h 2> /dev/null | | | | | |_____| | |_________________| |___| | | | | | | |________ Place at where | | | | there is no end. find command -type d will |_To segregate the | Redirect the output search only directory type list with common | in null device if file and -exec will execute output. | you do not want to or run du command as | store the output. supplied to find command. | sort command with -h option will sort lines by human readable data size format.
{

Delete all files except the tarball files.

}
rm command is use to remove files and with option -r which remove recursively; in other words contents of the directory, and with option -f it will never prompt for confirmation to delete a file. | | |____ _________________Anything in between dollar and parenthesis $() | | | | character will execute and output will be on | | | | same place. # rm -rf $(ls [^*.tar.*]) | | | | | | | |________| | | ls command to | list content | of the directory. | | In between square brackets [] character a conditional match is done. In this the carat ^ character is use to invert the given input in conditional match. Asterik * chracter is a wildcard chracter in conditional match which means any or zero to match.
{

Find IP addresses from logs.

}
To search given pattern | | Asterik character is use to The backward slash is a escape character | match anything or none. In which is use to know the shell that given | this there may be two more character is not a part of regurlar | number in each octet or expression or in other words avoid to use | none. as regular expression. Dot is a one kind | | __________of regular expression which use to match | | | any but not empty. | | | # grep '[1-9]*\.[0-9]*\.[0-9]*\.[1-9]*' /var/log/syslog | | | | | | | | |___| |___| |___| |___| | | | | | | | | Range are declared by putting dash - character in between numbers from 1 to 9 for the first and the fourth octet and 0 to 9 for the second and third octet of IP address. In first and fourth octet First number would be higher than zero and in the second and third octet first number can be 0 or higher than zero.