I am currently using an alias for ifconfig as iip=ifconfig | grep 'broadcast\|wlan\|eth0' which simply shows me the lines containing IP address for ethernet and wireless network adapter. Every time I need internal/private IP, I run this simple alias. But then I have to copy the IP address manually.Is there any command which would copy the internal/private IP address directly into the clipboard for use (the command would recognize an IP address which is in format *.*.*.* where if value of any * is 255 (netmask or broadcast address) then do not copy that pattern, else copy the pattern into clipboard)Edit: I'm talking about the buffer that holds the copied value in memory
Script/command to copy internal IP address directly into clipboard
shell;clipboard
Use a tool like sed or awk to extract the part of the output you want. Then use xsel (pbcopy on macOS) to copy that to the clipboard.Note that the interface name is not on the same line as the IP address, so filtering has to take multiple lines into account.ifconfig | awk '    /^[^ ]/ {interface = $1}    $1==inet && interface ~ /^(broadcast|wlan|eth0)$/ {sub(/^addr:/, , $2); print $2}' | xsel -b