alias for netstat command


used the netstat command to find various IP addresses on a particular network... decided to create an alias for it.

COMMAND
------------------------------------------------
--> netstat -an | grep 192 | awk '{print $5}' | awk -F : '{print $1}' | sort | uniq
173.194.123.47
31.13.70.81
63.235.21.123
69.171.235.19
74.125.224.151
74.125.224.159
74.125.239.53
74.125.28.189
74.125.28.95
75.186.69.215

------------------------------------------------
test string with echo and quotes
------------------------------------------------
--> echo "netstat -an | grep 192 | awk '{print $5}' | awk -F : '{print $1}' | sort | uniq"
netstat -an | grep 192 | awk '{print }' | awk -F : '{print }' | sort | uniq

------------------------------------------------
replace echo with alias 
------------------------------------------------
--> alias nst="netstat -an | grep 192 | awk '{print $5}' | awk -F : '{print $1}' | sort | uniq"

------------------------------------------------
 list aliases
------------------------------------------------
--> alias
alias +='pushd .'
alias -='popd'
alias ..='cd ..'
alias ...='cd ../..'
alias beep='echo -en "\007"'
alias cd..='cd ..'
alias cp='/bin/cp -i'
alias dfh='/bin/df -h | /bin/grep sd'
alias dir='ls -l'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='/bin/ls -al'
alias la='ls -la'
alias ll='/bin/ls -l'
alias lm='/bin/ls -l | more'
alias ls='_ls'
alias ls-l='ls -l'
alias md='mkdir -p'
alias mroe='more'
alias mv='/bin/mv -i'
#   where did $5 and $1 go?
alias nst='netstat -an | grep 192 | awk '\''{print }'\'' | awk -F : '\''{print }'\'' | sort | uniq'
alias o='less'
alias rd='rmdir'
alias rehash='hash -r'
alias rm='rm -i'
alias unmount='echo "Error: Try the command: umount" 1>&2; false'
alias vi='/usr/bin/vim'
alias you='if test "$EUID" = 0 ; then /sbin/yast2 online_update ; else su - -c "/sbin/yast2 online_update" ; fi'

------------------------------------------------
 oops... where's my $ values? 
------------------------------------------------

alias nst='netstat -an | grep 192 | awk '\''{print }'\'' | awk -F : '\''{print }'\'' | sort | uniq'

attempted fix:  (need to escape $5 and $1)
alias nst='netstat -an | grep 192 | awk '\''{print '\'$5 }'\'' | awk -F : '\''{print '\'$1}'\'' | sort | uniq'

--> alias nst="'netstat -an | grep 192 | awk '\''{print '\$'5 }'\'' | awk -F : '\''{print '\'$'1}'\'' | sort | uniq'"
------------------------------------------------
--> nst
If 'netstat -an | grep 192 | awk '{print 5 }' | awk -F : '{print '1}' | sort | uniq' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf netstat -an | grep 192 | awk '{print 5 }' | awk -F : '{print '1}' | sort | uniq


.... to be continued...




-- Linux commands, scripts, tools and systems administration --


SEARCH and Navigation TOOL
Google     select a domain to search or visit.
(use back key to return )

johnmeister.com/jeep/sj
JeepMeister
"Jeep is America's
only real sports car."
-Enzo Ferrari
JohnMeister.com LinuxMeister
MeisterTech FotoMeister.us
BibleTech the rest of the web

AMSOIL product guide click
and enter your year, make and model.


assorted links
Everett weather -- Seattle - Everett traffic -- assorted News
parallel NASB/KJV -- BBC: Middle East
South East Asian Missions -- Voice of the Martyrs


Nuts-Bolts-Wrench specs

john's vehicle history since 1972