how to print interface names only
up vote
1
down vote
favorite
i want to print interface names only from iwconfig
command
this is output of iwconfig
:
wlp2s0 IEEE 802.11 ESSID:"CoreFragment"
Mode:Managed Frequency:2.442 GHz Access Point: 0C:D2:B5:55:DF:74
Bit Rate=72.2 Mb/s Tx-Power=22 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=55/70 Signal level=-55 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:4 Invalid misc:6567 Missed beacon:0
enp3s0 no wireless extensions.
wlx00e02d01076f IEEE 802.11bgn ESSID:"Aleph_inCar" Nickname:"<WIFI@REALTEK>"
Mode:Master Frequency:2.412 GHz Access Point: 00:E0:2D:01:07:6F
Bit Rate:72.2 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=4/100 Signal level=4/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
lo no wireless extensions.
enx001e101f0000 no wireless extensions.
I tried this :
iwconfig | grep ESSID | sed 's/"//g' | cut -f1 -d" "
but i got no wireless extension also in output
i want to get output from iwconfig
command only
how print wlp2s0,enp3s0,wlx00e02d01076f,enx001e101f0000
only...
ubuntu network-interface
New contributor
|
show 1 more comment
up vote
1
down vote
favorite
i want to print interface names only from iwconfig
command
this is output of iwconfig
:
wlp2s0 IEEE 802.11 ESSID:"CoreFragment"
Mode:Managed Frequency:2.442 GHz Access Point: 0C:D2:B5:55:DF:74
Bit Rate=72.2 Mb/s Tx-Power=22 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=55/70 Signal level=-55 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:4 Invalid misc:6567 Missed beacon:0
enp3s0 no wireless extensions.
wlx00e02d01076f IEEE 802.11bgn ESSID:"Aleph_inCar" Nickname:"<WIFI@REALTEK>"
Mode:Master Frequency:2.412 GHz Access Point: 00:E0:2D:01:07:6F
Bit Rate:72.2 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=4/100 Signal level=4/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
lo no wireless extensions.
enx001e101f0000 no wireless extensions.
I tried this :
iwconfig | grep ESSID | sed 's/"//g' | cut -f1 -d" "
but i got no wireless extension also in output
i want to get output from iwconfig
command only
how print wlp2s0,enp3s0,wlx00e02d01076f,enx001e101f0000
only...
ubuntu network-interface
New contributor
yash did you try to pass the interface likewlp2s0
to the ifconfig command?
– Valentin Bajrami
2 days ago
yes.. I tried but i want to see my output from iwconfig @ValentinBajrami
– yash shah
2 days ago
1
then the easiest way would beiwconfig 2>/dev/null | awk '/ESSID/{print $1}'
– Valentin Bajrami
2 days ago
1
Unclear: You say you don't want the interfaces with no wireless extension, but then you list these in the desired output. What are you going to use the wireless interface names for?
– Kusalananda
2 days ago
2
Ok, so the question changed once again. Do you wantlo
also in the output? Why would you wantenp3s0
in the output. Why does it have to do with wireless interfaces?
– Valentin Bajrami
2 days ago
|
show 1 more comment
up vote
1
down vote
favorite
up vote
1
down vote
favorite
i want to print interface names only from iwconfig
command
this is output of iwconfig
:
wlp2s0 IEEE 802.11 ESSID:"CoreFragment"
Mode:Managed Frequency:2.442 GHz Access Point: 0C:D2:B5:55:DF:74
Bit Rate=72.2 Mb/s Tx-Power=22 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=55/70 Signal level=-55 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:4 Invalid misc:6567 Missed beacon:0
enp3s0 no wireless extensions.
wlx00e02d01076f IEEE 802.11bgn ESSID:"Aleph_inCar" Nickname:"<WIFI@REALTEK>"
Mode:Master Frequency:2.412 GHz Access Point: 00:E0:2D:01:07:6F
Bit Rate:72.2 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=4/100 Signal level=4/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
lo no wireless extensions.
enx001e101f0000 no wireless extensions.
I tried this :
iwconfig | grep ESSID | sed 's/"//g' | cut -f1 -d" "
but i got no wireless extension also in output
i want to get output from iwconfig
command only
how print wlp2s0,enp3s0,wlx00e02d01076f,enx001e101f0000
only...
ubuntu network-interface
New contributor
i want to print interface names only from iwconfig
command
this is output of iwconfig
:
wlp2s0 IEEE 802.11 ESSID:"CoreFragment"
Mode:Managed Frequency:2.442 GHz Access Point: 0C:D2:B5:55:DF:74
Bit Rate=72.2 Mb/s Tx-Power=22 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=55/70 Signal level=-55 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:4 Invalid misc:6567 Missed beacon:0
enp3s0 no wireless extensions.
wlx00e02d01076f IEEE 802.11bgn ESSID:"Aleph_inCar" Nickname:"<WIFI@REALTEK>"
Mode:Master Frequency:2.412 GHz Access Point: 00:E0:2D:01:07:6F
Bit Rate:72.2 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=4/100 Signal level=4/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
lo no wireless extensions.
enx001e101f0000 no wireless extensions.
I tried this :
iwconfig | grep ESSID | sed 's/"//g' | cut -f1 -d" "
but i got no wireless extension also in output
i want to get output from iwconfig
command only
how print wlp2s0,enp3s0,wlx00e02d01076f,enx001e101f0000
only...
ubuntu network-interface
ubuntu network-interface
New contributor
New contributor
edited 2 days ago
Kusalananda
119k16223364
119k16223364
New contributor
asked 2 days ago
yash shah
85
85
New contributor
New contributor
yash did you try to pass the interface likewlp2s0
to the ifconfig command?
– Valentin Bajrami
2 days ago
yes.. I tried but i want to see my output from iwconfig @ValentinBajrami
– yash shah
2 days ago
1
then the easiest way would beiwconfig 2>/dev/null | awk '/ESSID/{print $1}'
– Valentin Bajrami
2 days ago
1
Unclear: You say you don't want the interfaces with no wireless extension, but then you list these in the desired output. What are you going to use the wireless interface names for?
– Kusalananda
2 days ago
2
Ok, so the question changed once again. Do you wantlo
also in the output? Why would you wantenp3s0
in the output. Why does it have to do with wireless interfaces?
– Valentin Bajrami
2 days ago
|
show 1 more comment
yash did you try to pass the interface likewlp2s0
to the ifconfig command?
– Valentin Bajrami
2 days ago
yes.. I tried but i want to see my output from iwconfig @ValentinBajrami
– yash shah
2 days ago
1
then the easiest way would beiwconfig 2>/dev/null | awk '/ESSID/{print $1}'
– Valentin Bajrami
2 days ago
1
Unclear: You say you don't want the interfaces with no wireless extension, but then you list these in the desired output. What are you going to use the wireless interface names for?
– Kusalananda
2 days ago
2
Ok, so the question changed once again. Do you wantlo
also in the output? Why would you wantenp3s0
in the output. Why does it have to do with wireless interfaces?
– Valentin Bajrami
2 days ago
yash did you try to pass the interface like
wlp2s0
to the ifconfig command?– Valentin Bajrami
2 days ago
yash did you try to pass the interface like
wlp2s0
to the ifconfig command?– Valentin Bajrami
2 days ago
yes.. I tried but i want to see my output from iwconfig @ValentinBajrami
– yash shah
2 days ago
yes.. I tried but i want to see my output from iwconfig @ValentinBajrami
– yash shah
2 days ago
1
1
then the easiest way would be
iwconfig 2>/dev/null | awk '/ESSID/{print $1}'
– Valentin Bajrami
2 days ago
then the easiest way would be
iwconfig 2>/dev/null | awk '/ESSID/{print $1}'
– Valentin Bajrami
2 days ago
1
1
Unclear: You say you don't want the interfaces with no wireless extension, but then you list these in the desired output. What are you going to use the wireless interface names for?
– Kusalananda
2 days ago
Unclear: You say you don't want the interfaces with no wireless extension, but then you list these in the desired output. What are you going to use the wireless interface names for?
– Kusalananda
2 days ago
2
2
Ok, so the question changed once again. Do you want
lo
also in the output? Why would you want enp3s0
in the output. Why does it have to do with wireless interfaces?– Valentin Bajrami
2 days ago
Ok, so the question changed once again. Do you want
lo
also in the output? Why would you want enp3s0
in the output. Why does it have to do with wireless interfaces?– Valentin Bajrami
2 days ago
|
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Your command works perfectly. Simply redirect the STDERR output to STDOUT, so that grep
and cut
process them as you want:
iwconfig 2>&1 | grep ESSID | sed 's/"//g' | cut -f1 -d" "
However, this method using grep
, sed
and cut
is an overkill. A single grep
can get you what you want as suggested in the update below.
UDPATE:
As per the edited question, and given that the user is using Ubuntu (and hence the grep
supports Perl regex), here is one method:
iwconfig 2>&1 | grep -oP "^w+"
how I can remove lo from your suggested command :iwconfig 2>&1 | grep -oP "^w+"
– yash shah
2 days ago
otherwise it works... @shivams
– yash shah
2 days ago
I think the use ofgrep
,sed
andcut
is overkill for such a trivial task
– Valentin Bajrami
2 days ago
@ValentinBajrami Yes. But the combination of the 3 was the one suggested by the OP. I have suggested an updated version.
– shivams
2 days ago
@yashshah to removelo
, just add one moregrep
to the pipe:iwconfig 2>&1 | grep -oP "^w+" | grep -v lo
– shivams
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Your command works perfectly. Simply redirect the STDERR output to STDOUT, so that grep
and cut
process them as you want:
iwconfig 2>&1 | grep ESSID | sed 's/"//g' | cut -f1 -d" "
However, this method using grep
, sed
and cut
is an overkill. A single grep
can get you what you want as suggested in the update below.
UDPATE:
As per the edited question, and given that the user is using Ubuntu (and hence the grep
supports Perl regex), here is one method:
iwconfig 2>&1 | grep -oP "^w+"
how I can remove lo from your suggested command :iwconfig 2>&1 | grep -oP "^w+"
– yash shah
2 days ago
otherwise it works... @shivams
– yash shah
2 days ago
I think the use ofgrep
,sed
andcut
is overkill for such a trivial task
– Valentin Bajrami
2 days ago
@ValentinBajrami Yes. But the combination of the 3 was the one suggested by the OP. I have suggested an updated version.
– shivams
2 days ago
@yashshah to removelo
, just add one moregrep
to the pipe:iwconfig 2>&1 | grep -oP "^w+" | grep -v lo
– shivams
2 days ago
add a comment |
up vote
2
down vote
accepted
Your command works perfectly. Simply redirect the STDERR output to STDOUT, so that grep
and cut
process them as you want:
iwconfig 2>&1 | grep ESSID | sed 's/"//g' | cut -f1 -d" "
However, this method using grep
, sed
and cut
is an overkill. A single grep
can get you what you want as suggested in the update below.
UDPATE:
As per the edited question, and given that the user is using Ubuntu (and hence the grep
supports Perl regex), here is one method:
iwconfig 2>&1 | grep -oP "^w+"
how I can remove lo from your suggested command :iwconfig 2>&1 | grep -oP "^w+"
– yash shah
2 days ago
otherwise it works... @shivams
– yash shah
2 days ago
I think the use ofgrep
,sed
andcut
is overkill for such a trivial task
– Valentin Bajrami
2 days ago
@ValentinBajrami Yes. But the combination of the 3 was the one suggested by the OP. I have suggested an updated version.
– shivams
2 days ago
@yashshah to removelo
, just add one moregrep
to the pipe:iwconfig 2>&1 | grep -oP "^w+" | grep -v lo
– shivams
2 days ago
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Your command works perfectly. Simply redirect the STDERR output to STDOUT, so that grep
and cut
process them as you want:
iwconfig 2>&1 | grep ESSID | sed 's/"//g' | cut -f1 -d" "
However, this method using grep
, sed
and cut
is an overkill. A single grep
can get you what you want as suggested in the update below.
UDPATE:
As per the edited question, and given that the user is using Ubuntu (and hence the grep
supports Perl regex), here is one method:
iwconfig 2>&1 | grep -oP "^w+"
Your command works perfectly. Simply redirect the STDERR output to STDOUT, so that grep
and cut
process them as you want:
iwconfig 2>&1 | grep ESSID | sed 's/"//g' | cut -f1 -d" "
However, this method using grep
, sed
and cut
is an overkill. A single grep
can get you what you want as suggested in the update below.
UDPATE:
As per the edited question, and given that the user is using Ubuntu (and hence the grep
supports Perl regex), here is one method:
iwconfig 2>&1 | grep -oP "^w+"
edited 2 days ago
answered 2 days ago
shivams
2,86611425
2,86611425
how I can remove lo from your suggested command :iwconfig 2>&1 | grep -oP "^w+"
– yash shah
2 days ago
otherwise it works... @shivams
– yash shah
2 days ago
I think the use ofgrep
,sed
andcut
is overkill for such a trivial task
– Valentin Bajrami
2 days ago
@ValentinBajrami Yes. But the combination of the 3 was the one suggested by the OP. I have suggested an updated version.
– shivams
2 days ago
@yashshah to removelo
, just add one moregrep
to the pipe:iwconfig 2>&1 | grep -oP "^w+" | grep -v lo
– shivams
2 days ago
add a comment |
how I can remove lo from your suggested command :iwconfig 2>&1 | grep -oP "^w+"
– yash shah
2 days ago
otherwise it works... @shivams
– yash shah
2 days ago
I think the use ofgrep
,sed
andcut
is overkill for such a trivial task
– Valentin Bajrami
2 days ago
@ValentinBajrami Yes. But the combination of the 3 was the one suggested by the OP. I have suggested an updated version.
– shivams
2 days ago
@yashshah to removelo
, just add one moregrep
to the pipe:iwconfig 2>&1 | grep -oP "^w+" | grep -v lo
– shivams
2 days ago
how I can remove lo from your suggested command :iwconfig 2>&1 | grep -oP "^w+"
– yash shah
2 days ago
how I can remove lo from your suggested command :iwconfig 2>&1 | grep -oP "^w+"
– yash shah
2 days ago
otherwise it works... @shivams
– yash shah
2 days ago
otherwise it works... @shivams
– yash shah
2 days ago
I think the use of
grep
, sed
and cut
is overkill for such a trivial task– Valentin Bajrami
2 days ago
I think the use of
grep
, sed
and cut
is overkill for such a trivial task– Valentin Bajrami
2 days ago
@ValentinBajrami Yes. But the combination of the 3 was the one suggested by the OP. I have suggested an updated version.
– shivams
2 days ago
@ValentinBajrami Yes. But the combination of the 3 was the one suggested by the OP. I have suggested an updated version.
– shivams
2 days ago
@yashshah to remove
lo
, just add one more grep
to the pipe: iwconfig 2>&1 | grep -oP "^w+" | grep -v lo
– shivams
2 days ago
@yashshah to remove
lo
, just add one more grep
to the pipe: iwconfig 2>&1 | grep -oP "^w+" | grep -v lo
– shivams
2 days ago
add a comment |
yash shah is a new contributor. Be nice, and check out our Code of Conduct.
yash shah is a new contributor. Be nice, and check out our Code of Conduct.
yash shah is a new contributor. Be nice, and check out our Code of Conduct.
yash shah is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f486528%2fhow-to-print-interface-names-only%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
yash did you try to pass the interface like
wlp2s0
to the ifconfig command?– Valentin Bajrami
2 days ago
yes.. I tried but i want to see my output from iwconfig @ValentinBajrami
– yash shah
2 days ago
1
then the easiest way would be
iwconfig 2>/dev/null | awk '/ESSID/{print $1}'
– Valentin Bajrami
2 days ago
1
Unclear: You say you don't want the interfaces with no wireless extension, but then you list these in the desired output. What are you going to use the wireless interface names for?
– Kusalananda
2 days ago
2
Ok, so the question changed once again. Do you want
lo
also in the output? Why would you wantenp3s0
in the output. Why does it have to do with wireless interfaces?– Valentin Bajrami
2 days ago