LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-18-2014, 04:15 AM   #1
devaraj_nandagopal
LQ Newbie
 
Registered: Aug 2012
Posts: 5

Rep: Reputation: Disabled
Help Me!!! How to find interface uptime in Linux


Hi All,

Can anyone help me to find out the uptime of network interface in linux. is there any log file maintains the network restart activities.

Need to know how long the interface eth0 is running in the server.

Thanks
 
Old 09-18-2014, 04:17 AM   #2
yooy
Senior Member
 
Registered: Dec 2009
Posts: 1,387

Rep: Reputation: 174Reputation: 174
you can probably calculate from
Quote:
dmesg
or similar log. Just look for last interface start and calculate from current time.
 
Old 09-24-2014, 07:46 AM   #3
GunFighT
Member
 
Registered: May 2014
Location: Romania
Distribution: Debian/Ubuntu, Rocky Linux
Posts: 53

Rep: Reputation: Disabled
Tested the variant:
# expr $(echo $(date +%s) - $(date -d "`grep 'eth0: leased' /var/log/messages | tail -1 | awk '{print $1, $2, $3}'`" +%s))

The output is in seconds.

Source website:
http://superuser.com/questions/61714...terface-uptime
 
Old 09-24-2014, 08:57 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,342
Blog Entries: 28

Rep: Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145
Whoops. Reading comprehension issues.

Last edited by frankbell; 09-24-2014 at 08:58 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find the linux interface gateway ghoshdastidar1980 Linux - Newbie 1 10-02-2012 04:32 AM
Best way to find out primary interface on RHEL Linux linux_user2011 Linux - Newbie 3 04-15-2011 12:24 AM
init uptime longer than system uptime? m4rtin Linux - Server 1 09-15-2010 07:45 AM
Finding out interface uptime GSMD Linux - Networking 4 12-13-2007 04:06 PM
is there any fun() available in linux to find system uptime without using sysinfo uppala MEPIS 2 06-15-2005 09:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration