Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.
Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!
Hide

Top Tags

Hide

Functions

Print the IP address and the Mac address in the same line

Terminal - Print the IP address and the Mac address in the same line
ifconfig | head -n 2 | tr -d '\n' | sed -n 's/.*\(00:[^ ]*\).*\(adr:[^ ]*\).*/mac:\1 - \2/p'
2014-09-03 14:35:27
User: Koobiac
Functions: head ifconfig sed tr
1
Print the IP address and the Mac address in the same line

Print the IP address and the Mac address in the same line

Alternatives

There are 17 alternatives - vote for the best!

Terminal - Alternatives
ifconfig | egrep -A2 "eth|wlan" | tr -d "\n"| sed 's/\-\-/\n/g'|awk '{print "mac: "$5 " " $7}' | sed 's/addr:/addr: /g'

Know a better way?

If you can do better, submit your command here.

What others think

what os are you doing this on? tried on ubuntu and osx, both no go.

Comment by chrismccoy 171 weeks and 1 day ago

I had to use ifconfig wlan1 where wlan1 is the interface on my computer (most likely it'll be different on another computer) and change the part where it has adr to addr like this

ifconfig wlan1 | head -n 2 | tr -d '\n' | sed -n 's/.*\(00:[^ ]*\).*\(addr:[^ ]*\).*/MAC:\1 - \2/p' ; echo

Plus I added an empty line with "; echo" at the end.

Comment by ronin9999 171 weeks ago

I also tried this on another computer but had to change the 00: to the starting hexadecimal values of the MAC address of my interface, like 14: instead. So the whole thing is ifconfig wlan0 | head -n 2 | tr -d '\n' | sed -n 's/.*\(14:[^ ]*\).*\(addr:[^ ]*\).*/MAC:\1 - \2/p' ; echo

Comment by ronin9999 171 weeks ago

@Chrismccoy : on SLES (Suse)

@Ronin : You can customize the syntax as needed, great job.

Comment by Koobiac 170 weeks and 5 days ago

i tryed this :

ifconfig | grep -A2 eth | tr -d "\n"| sed 's/\-\-/\n/g'|awk '{print "mac: "$5 " " $7}' | sed 's/addr:/addr: /g'

and should work for all network interfaces.

Comment by mass1 170 weeks and 5 days ago

this version should work also for "wlan" interfaces :

ifconfig | egrep -A2 "eth|wlan" | tr -d "\n"| sed 's/\-\-/\n/g'|awk '{print "mac: "$5 " " $7}' | sed 's/addr:/addr: /g'
Comment by mass1 170 weeks and 5 days ago

Thx for sharing ;)

Comment by Koobiac 170 weeks and 4 days ago

http://www.beatsheadphone.in.net/, http://www.cheapshoes.net.co/, http://www.katespadeoutlet.gb.net/, http://www.mizuno-running.net/, http://www.new-balancecanada.ca/, http://www.adidas-shoes.ca/, http://www.mcm-handbags.org/, http://bills.nfljersey.us.com/, http://www.ralphlaurens.ca/, http://www.vans-shoes.co.uk/, http://www.hermes-birkinoutlet.net/, http://coach-outlet.tumblr.com/, http://www.women-clothes.com/, http://www.tomsshoes-outlet.us.org/, http://www.michaelkorsoutletonline.net.co/, http://www.coach-factoryoutlet.net.co/, http://www.burberry-outlet.in.net/, http://www.nba-jersey.com/, http://www.tommy-hilfigers.de/, http://www.burberryonlineshop.de/, http://www.rolex-watchoutlet.com/, http://www.ok-em.com/, http://www.nikefreeshoes-inc.co.uk/, http://www.coach-factory.com.co/, http://www.toryburch-outlet.com.co/, http://www.timberlandspaschere.fr/, http://airmax.misblackfriday.com/, http://www.longchamp-bags.us.com/, http://www.burberry-outlets-online.org.uk/, http://www.coachoutlet-online.com.co/, http://www.louboutin.jp.net/, http://www.soccer-shoesoutlet.com/, http://www.nike-airmax.com.de/, http://www.burberrybags.net.co/, http://colts.nfljersey.us.com/, http://www.marc-jacobs.us.com/, http://www.nike-shoesfactory.us/, http://www.barbour.in.net/, http://pacers.nba-jersey.com/, http://www.philipp-pleins.com/, http://www.coach-outletonline.ca/, http://www.tommy-hilfigers.in.net/, http://www.nikeairmax-90.net/, http://www.calvin-kleins.in.net/, http://www.mcm-bags.us.org/, http://www.raybans-outlet.org.uk/, http://patriots.nfljersey.us.com/, http://www.polo-ralph-lauren.de/, http://www.oakleysunglasses-canada.ca/, http://www.nike-outlet.us.org/, http://jazz.nba-jersey.com/, http://www.niketnrequinpaschers.fr/, http://www.hollister-clothing.com.co/, http://www.wedding-dresses.cc/, http://www.the-north-face.org.uk/, http://pelicans.nba-jersey.com/, http://www.burberry-bags.net/, http://www.michael-kors.cc/, http://www.nike-shoes.com.co/, http://www.jerseys-store.com/, http://www.airmax.com.se/, http://www.barbour-factory.net/, http://www.juicycouture.com.co/, http://www.raybanoutlet.ca/, http://www.michael-kors.in.net/, http://www.montrespaschers.fr/, http://www.salomonshoes.com.de/, http://www.fendi-outlet.in.net/, http://www.mk-com.com/, http://www.oakleys-outlet.in.net/, http://www.tommyhilfigerca.ca/, http://www.toryburchsale.com.co/, http://www.bcbg-dresses.net/, http://dolphins.nfljersey.us.com/, http://www.adidas-shoes.nl/, http://www.coachblackfriday.com/, http://www.rayban-sunglasses.fr/, http://www.nikefree-runs.org.uk/, http://www.the-northfacejackets.net.co/, http://www.hollister-store.com/, http://raptors.nba-jersey.com/, http://www.cheap-jordans.net/, http://www.ray-bans-sunglasses.net/, http://www.pandora-jewelry.com.de/, http://www.nike-skors.com.se/, http://www.cheap-mlbjerseys.us.com/, http://www.celine-bags.com/, http://celine.blackofriday.com/, http://www.asics-outlets.com/, http://www.thenorth-face.com.co/, http://www.chiflatiron.net.co/, http://www.christian-louboutinshoes.in.net/, http://www.nike-air-force.de/, http://hawks.nba-jersey.com/, http://www.nikefree-run.net/, http://www.adidasshoes.com.se/, http://www.pulseraspandora.com.es/, http://www.prada-shoes.com.co/, http://www.pandoras-charms.org.uk/, http://www.cheap-rolex-watches.org.uk/, http://jaguars.nfljersey.us.com/, http://www.oakleys-frame.com.co/, http://www.newoutletonlinemall.com/, http://www.barbours.us.com/, http://rams.nfljersey.us.com/, http://www.michaels-kors.us/, http://www.michaelkors-outletonline.cc/, http://www.ray-bansoutlet.com.co/, http://www.oakley-outletonline.com.co/, http://bengals.nfljersey.us.com/, http://www.lauren-ralphsoutlet.co.uk/, http://www.the-northfaces.net.co/, http://www.juicycoutureoutlet.net.co/, http://www.long-champ.com.de/, http://www.jordanshoes.net.co/, http://www.pradas.com.de/, http://www.bottega-bags.com/, http://www.oakley-sbocco.it/, http://bucks.nba-jersey.com/, http://www.ralphlaurens-outlet.co.uk/, http://www.marcjacobs-outlet.com/, http://www.p90xs-workout.com/, http://www.mcmhandbags.com.co/, http://www.michaelkors-canadaoutlet.ca/, http://www.tommyhilfigers.nl/, http://www.prada-bagsoutlet.com/, http://www.cheapthomas-sabos.co.uk/, http://www.ed-hardy.us.com/, http://www.coach-outlets.net.co/, http://packers.nfljersey.us.com/, http://www.toms-shoesstore.com.co/, http://www.ray-banssale.com/, http://www.ray-bans.co.uk/, http://hornets.nba-jersey.com/, http://www.michaelkorsoutlet.se/, http://www.hollisters-canada.ca/, http://www.nikeairmax2015.org/, http://www.dsquared2s.com/, http://www.omega-watches.com.co/, http://www.prada-outlet.com.co/, http://www.michaels-korsoutlet.co.uk/, http://ralphlauren.blackofriday.com/, http://www.christian-louboutin.jp.net/, http://celtics.nba-jersey.com/, http://www.polos-ralphlauren.com.co/, http://www.kate-spades.com.co/, http://www.ralphlauren-polos.com.co/, http://www.polo-ralphlaurens.us.com/, http://www.nike-shoesoutlet.com/, http://www.cheap-michaelkors.com.co/, http://www.ralphslaurenoutlet.us.com/, http://www.true-religion.com.co/, http://www.nike-airmaxs.fr/, http://www.ralph-laurenpolosoutlet.com/, http://www.coach-outlet.store/, http://www.nhl-jerseys.net/, http://www.ferragamoshoes.in.net/, http://www.burberry-outletcanada.ca/, http://www.cheap-baseballbats.us/, http://www.nike-shoescanada.ca/, http://www.kates-spade.com/, http://www.hoodies-store.com/, http://www.longchamp.com.co/, http://warriors.nba-jersey.com/, http://www.oakleys.org.es/, http://www.cheap-rayban.com.co/, http://www.raybans.org.es/, http://timberwolves.nba-jersey.com/, http://www.converse-shoes.net/, http://www.coachfactory.cc/, http://www.oakleys-outlets.net/, http://www.swarovski-australia.com.au/, http://www.beatsbydrdrephone.com/, http://www.burberry-store.com/, http://www.polos-outlets.com/, http://www.raybans-sunglasses.net.co/, http://www.hugo-boss.com.co/, http://buccaneers.nfljersey.us.com/, http://falcons.nfljersey.us.com/, http://www.raybans-outlet.nl/, http://www.tommyhilfigers.de/, http://www.mk-outletonline.us/, http://www.toms--outlet.com.co/, http://www.armani-exchange.in.net/, http://www.tnf-jackets.us/, http://www.christianlouboutinoutlet.net.co/, http://www.babyliss-pros.com/, http://www.ralph-laurenpolos.co.uk/, http://www.co-aol.com/, http://www.toms-shoe.us.org/, http://www.thomas-sabos.com.de/, http://www.tommys-hilfiger.com/, http://www.salvatore-ferragamos.com/, http://www.swarovski-canada.ca/, http://www.basketballshoes.com.co/, http://www.versace-outlet.com/, http://www.michael-korsoutlet.co.uk/, http://www.true-religions.com/, http://www.designer-handbags.cc/, http://www.valentino-shoesoutlet.us.com/, http://www.cheap-raybansoutlet.com.co/, http://www.hollisteronlineshop.com.de/, http://www.ralphs-laurenpolo.co.uk/, http://www.katespades.com.co/, http://www.ralphlaurenonlineshop.de/, http://www.michael-kors-outlet.us.org/, http://www.hollister.com.se/, http://www.the-northface.ca/, http://www.ray-bans.net.co/, http://www.airmax-shoes.com/, http://www.raybans-outlet.cc/, http://www.timberlandshoes.net.co/, http://www.swarovski-jewelrys.com/, http://www.nike-store.com.de/, http://www.chiflatirons.in.net/, http://www.nike-store.in.net/, http://www.jimmy-choosshoes.com/, http://www.retro-jordans.net/, http://www.soccers-shoes.net/, http://www.mbt-outlet.com/, http://www.nba-shoes.com/, http://jets.nfljersey.us.com/, http://www.toryburch-shoesoutlet.com/, http://www.beatsbydre.com.co/, http://www.air-yeezys.com/, http://heat.nba-jersey.com/, http://www.christian-louboutins.co.uk/, http://www.under-armouroutlet.com/, http://www.poloralphlaurenoutlet.net.co/, http://www.michael-korsoutlet.cc/, http://www.converse.net.co/, http://kings.nba-jersey.com/, http://www.levisjeans.com.co/, http://nets.nba-jersey.com/, http://rockets.nba-jersey.com/, http://www.reeboks.com.de/, http://www.rolexwatches-canada.ca/, http://www.cheap-jerseys.mex.com/, http://www.tommy-hilfiger.net.co/, http://www.the-northfaces.us.com/, http://www.rolex-watches.us.com/, http://www.nikeshoesoutlet.org.uk/, http://49ers.nfljersey.us.com/, http://coach.euro-us.net/, http://www.mcms-handbags.com/, http://www.oakley-sunglassessale.com/, http://www.air-maxschoenen.nl/, http://www.barbour-jackets.us.com/, http://www.tracksuits-store.com/, http://www.designer-handbagsoutlet.us.com/, http://www.nikefree5.net/, http://titans.nfljersey.us.com/, http://www.ralphs-laurenpolos.net/, http://www.adidas-store.net/, http://www.nfljersey.us.com/, http://www.raybans-outlet.com.co/, http://www.coachsoutletonline.in.net/, http://redskins.nfljersey.us.com/, http://azcardinals.nfljersey.us.com/, http://longchamp.blackofriday.com/, http://www.longchampoutlet.com.co/, http://www.oakley-outlet.fr/, http://www.burberrys-outletonline.com/, http://www.hermesoutlet.shop/, http://www.longchampbags.com.co/, http://seahawks.nfljersey.us.com/, http://www.nikeair-max.ca/, http://www.polos-outletstore.net/, http://www.puma-shoes.de/, http://www.bcbg-maxazria.ca/, http://www.nike-air-max.com.au/, http://eagles.nfljersey.us.com/, http://giants.nfljersey.us.com/, http://www.truereligion-outlet.com.co/, http://www.long-champbags.com/, http://www.timberland-boots.com.co/, http://www.ralph-laurens.org.uk/, http://steelers.nfljersey.us.com/, http://www.iphonecases.net.co/, http://www.instylers.us/, http://wizards.nba-jersey.com/, http://www.michaelkors.so/, http://www.lacoste-store.com/, http://www.rosheruns.us/, http://www.puma-shoesoutlet.com/, http://www.michael-kors.shop/, http://www.supra-footwear.net/, http://www.asicsoutlet.us.org/, http://www.air-huaracheshoes.co.uk/, http://www.oakleys.com.de/, http://www.hollisters.us.com/, http://www.christianlouboutinshoesoutlet.org/, http://www.oakleys-outlet.com.co/, http://www.omegas-relojes.es/, http://www.hoganshoes.org.uk/, http://www.rayban-sunglasses.co/, http://www.nikestoreoutlet.us/, http://ravens.nfljersey.us.com/, http://www.chrome-hearts.com.co/, http://www.ralphlauren-au.com/, http://www.oakleys2017.com/, http://www.omegawatches.in.net/, http://www.adidassuper-star.de/, http://www.jordan.com.de/, http://www.long-champoutlet.com/, http://www.handbagsoutlet.in.net/, http://www.mcmbackpacks.net/, http://www.ralph-laurenoutletonline.in.net/, http://www.michaelkorsoutlet.ar.com/, http://www.vans-shoesoutlet.com/, http://www.woolrich-clearance.com/, http://www.giuseppes-zanotti.com/, http://lakers.nba-jersey.com/, http://www.north-face.com.co/, http://www.michaelkors.co.nl/, http://www.adidas-shoes.in.net/, http://www.swarovski-online-shop.de/, http://www.bottega-venetasoutlet.com/, http://www.jordan-retro.org/, http://www.rolexwatchesforsale.us.com/, http://www.nike-roshe-run.de/, http://www.oakleys-2017.in.net/, http://coach.blackofriday.com/, http://cowboys.nfljersey.us.com/, http://www.horlogesrolexs.nl/, http://www.toms-outletstore.com/, http://trailblazers.nba-jersey.com/, http://broncos.nfljersey.us.com/, http://www.roshe-run.co.uk/, http://www.nikeair-max.es/, http://bears.nfljersey.us.com/, http://mavericks.nba-jersey.com/, http://chiefs.nfljersey.us.com/, http://www.toms-shoes-outlet.us/, http://clippers.nba-jersey.com/, http://www.toms-outletonline.com.co/, http://bulls.nba-jersey.com/, http://vikings.nfljersey.us.com/, http://www.ferragamos.us.com/, http://www.soft-ballbats.com/, http://www.raybansbocco.it/, http://www.michael-kors.net.co/, http://saints.nfljersey.us.com/, http://www.converseschuhe.com.de/, http://www.new-balanceshoes.es/, http://www.true-religion-jeans.com.co/, http://www.converses-outlet.com/, http://www.nike-airmaxnc.co.uk/, http://www.barbour-jackets.com/, http://www.newbalance-shoes.org/, http://www.hermes-bags.net/, http://www.nike-airmax.us.com/, http://michaelkors.euro-us.net/, http://www.michaelkors.com.de/, http://www.coachfactory.shop/, http://www.the-northface.com.de/, http://www.hollisterclothings-store.com/, http://www.ferragamo.net.co/, http://www.swarovski-crystals.us.com/, http://www.outlet-burberry.net/, http://www.burberry-outlets.net.co/, http://www.givenchy.com.co/, http://www.nikeshoes.de/, http://www.montblanc-pens-sale.com/, http://www.supra-shoes.org/, http://www.mlb-jerseys.us.com/, http://76ers.nba-jersey.com/, http://www.burberry-outlets.org.uk/, http://rayban.blackofriday.com/, http://www.oakley-sunglass.net.co/, http://raiders.nfljersey.us.com/, http://www.iphone-cases.net/, http://pistons.nba-jersey.com/, http://www.burberry-handbagssale.net.co/, http://www.michaelkors-bags.us.org/, http://www.cheapoakleyss.com/, http://www.raybans.com.de/, http://www.soccershoes.us.com/, http://www.christianlouboutin-shoes.ca/, http://panthers.nfljersey.us.com/, http://www.raybans-cher.fr/, http://www.nike-schoenen.co.nl/, http://chargers.nfljersey.us.com/, http://www.nike-rosherun.com.es/, http://www.michael-korsbags.com.co/, http://www.oakleys.mex.com/, http://www.nikeshoes.org.es/, http://www.christian-louboutins.in.net/, http://www.thenorthfacejackets.fr/, http://www.oakley-sunglasses2017.com/, http://knicks.nba-jersey.com/, http://lions.nfljersey.us.com/, http://thunder.nba-jersey.com/, http://www.cheapnhljerseys.us.com/, http://www.cheapjerseys.net.co/, http://www.eyeglasses-outlet.com/, http://www.hogans.com.de/, http://www.giuseppezanotti.com.co/, http://spurs.nba-jersey.com/, http://www.pradahandbags.net.co/, http://www.tory-burch.us.org/, http://www.truereligion-outlet.us.org/, http://www.coachoutlet-inc.net/, http://www.replica-handbags.com.co/, http://www.nikeshoes-outlet.com/, http://www.michael-kors.com.es/, http://www.ralph-laurenoutletonline.com/, http://www.truereligions.net/, http://www.nfl-jersey.us.org/, http://www.burberry-handbags.net.co/, http://www.ecco-shoes.us.com/, http://www.nikerosherun.us/, http://www.timberlandbootsoutlet.us.com/, http://www.uhren-stores.de/, http://www.burberryoutlet-sale.com.co/, http://www.pandoracharms-canada.ca/, http://www.philipp-plein.us.com/, http://magic.nba-jersey.com/, http://www.cheap-watches.in.net/, http://www.oakleys-sunglasses.com.co/, http://www.michaelkorsoutlet-online.ar.com/, http://www.vibram-fivefingers.in.net/, http://nuggets.nba-jersey.com/, http://www.adidas-shoes.es/, http://www.vansschuhe.com.de/, http://www.nike-max.fr/, http://www.jimmy-chooshoes.com/, http://www.pandorajewelry.top/, http://www.nike-mercurial.com/, http://www.zcoachoutlet.com/, http://www.adidas-schuheonline.de/, http://browns.nfljersey.us.com/, http://www.nikeairmax.com.de/, http://www.cheapjerseys.us.org/, http://www.air-jordanshoes.us/, http://coachoutlet.euro-us.net/, http://www.airhuaraches.co.uk/, http://cavaliers.nba-jersey.com/, http://oakley.blackofriday.com/, http://www.nike-skos.com/, http://www.new-balanceoutlet.org/, http://www.scarpehogans.it/, http://michaelkors.blackofriday.com/, http://www.nike-rosheruns.nl/, http://suns.nba-jersey.com/, http://www.michael-kors-australia.com.au/, http://www.cheap-nike-shoes.net/, http://www.beats-by-dre.com.co/, http://www.michaelkors-ins.com/, http://www.new-balance-schuhe.de/, http://www.dsquared2-outlet.com/, http://texans.nfljersey.us.com/, http://www.pandorajewellery.com.au/, http://www.swarovskissale.co.uk/, http://www.michaelkors-store.us.org/, http://www.nike-free-runs.de/, http://grizzlies.nba-jersey.com/, http://www.toms-outlets.us.com/, http://www.oakley--sunglasses.com.au/, http://www.nike-huaraches.nl/

Comment by ylq 31 weeks and 2 days ago

Your point of view

You must be signed in to comment.