NM-ONLINE(1)
π NM-ONLINE(1) β like, the whole manual, bestie
okay so this is nm-online, a page from the General Commands Manual section 1, and I'm gonna walk you through it like we're texting at 1am π«Ά
β¨ NAME β¨
nm-online β the girl whose whole job is asking NetworkManager "are we online rn or not" π¦
β¨ SYNOPSIS β¨
nm-online [OPTIONS...]
that's it. that's the whole vibe. options go in the brackets, periodt π
β¨ DESCRIPTION β¨
so nm-online is a utility to find out whether we are online. literally its one purpose. and the way it does this is by asking NetworkManager about its status β she doesn't guess, she asks π
when you run it, nm-online waits until NetworkManager reports an active connection, or until the specified timeout expires. whichever comes first, no cap. and when it exits? you gotta check the returned status code (the return codes are down in EXIT STATUS, keep scrolling πΈ).
ngl, this tool is not very useful to call directly. like, it's not a main character you're supposed to hang out with. it is however used by NetworkManager-wait-online.service with the --wait-for-startup argument (peep NetworkManager-wait-online.service(8) for that one π).
okay now the important part, bestie, listen up: by default, connections have the ipv4.may-fail and ipv6.may-fail properties set to yes. what that means is NetworkManager waits for one of the two address families to complete configuration before considering the connection activated. so if you need a specific address family configured before network-online.target is reached, set the corresponding may-fail property to no. that's the whole trick π
β¨ OPTIONS β¨
-h,--helpβ print help information. the "what is this even" button π-q,--quietβ don't print anything. silence. not a peep. π-s,--wait-for-startupβ wait for NetworkManager startup to complete, rather than waiting for network connectivity specifically. startup is considered complete once NetworkManager has activated (or attempted to activate) every auto-activate connection which is available given the current network state. this corresponds to the moment when NetworkManager logsstartup complete. β¨
this mode is generally only useful at boot time. after startup has completed, nm-online -s will just return immediately, regardless of the current network state. like she literally does not care anymore, she's done π«
there are various ways to affect when startup complete is reached. for details see NetworkManager-wait-online.service(8).
-t,--timeoutseconds β time to wait for a connection, in seconds. if the option is not provided, the environment variableNM_ONLINE_TIMEOUTis honored. the default timeout is30seconds. clock's ticking bestie β°-x,--exitβ exit immediately if NetworkManager is not running or connecting. no waiting around, she leaves the group chat πͺ
β¨ EXIT STATUS β¨
nm-online exits with status 0 if it succeeds, and a value greater than 0 is returned if an error occurs. so like, always check. fr fr.
0β Success. already online, or connection established within the given timeout. slay π1β Offline, or not online within the given timeout. sad girl hours π2β Unknown or unspecified error. the "idk what happened" of exit codes π
β¨ SEE ALSO β¨
go read these next, i'm obsessed with cross-referencing:
lowkey a reminder: that exit status is the whole point of this utility, so pls pls pls check it, don't just fire and forget π
and that's the page, bestie! π this was NetworkManager 1.58.0, brought to you with love, and the date on this beauty is the same as always β signing off, mwah ππ
π¦ where this page comes from
- centos-stream 10: NetworkManager 1:1.58.0-1.el10 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms