Unix Command

List all unique IP addresses using unix command

$cat filename | sort -rn |uniq –u
>7, Unique ip

$cat filename | sort -rn |uniq
>9, ip with no duplicate

grep

$grep "404 NOT Found" srv01_npreo01_app.log
>list of error will display

$grep "404 NOT Found" srv01_npreo01_app.log | wc -l
>4025 (amount of 404)
$grep -i "time taken" app.log3632
$grep -i "time taken" app.log3632 | grep -v "status.jsp"

i means case nonsensitive
-v means dont include it

$grep -i "java.lang.NullPointerException" srv01_app.log | grep -i "T10160009"
> grep for both NullPointer and orderNumber T10160009

recurvsive grep

$find . -type f -exec grep -il "hello" {} \;
netstat -na|grep 7002

results matching ""

    No results matching ""