Get boot time linux

How to know boot time on Ubuntu

How to get via terminal log of system boot time for last month. I tried to use last boot command, bit it returned information from the beginning of month.

4 Answers 4

I know Ubuntu has systemd now, but I haven’t tested this out on Ubuntu. If you have systemd then the following command should work.

If you are trying to increase boot performance then you might want to look at the output of

In Ubuntu the file /var/log/wtmp ( last gets data from this file by default) is rotated by logrotate following this configuration :

As you can see it will be rotated monthly, with only one rotational file will exist meaning /var/log/wtmp will contain current month’s logs while /var/log/wtmp.1 will contain previous month’s logs. No logs prior to that will be saved. you can change this configuration to suite your need if you want.

Now while you run last command you will see current month’s logs as the file /var/log/wtmp is read by last by default. As we know that the previous month’s logs are saved in /var/log/wtmp.1 , we can tell last to read from that file using -f option :

Same goes for the /var/log/btmp file while using lastb .

Another alternative to retrieve the system boot date consist using vmstat(8) in statistics mode with —stats argument.

The command expose the following line:

So the line can be parsed with gawk(1) and the timestamp can be converted using the date(1) command to a human readable format with the command below:

 $ TIMESTAMP=$(vmstat --stats | awk '/boot time/') $ date -d @$TIMESTAMP or $ date -d @$(vmstat --stats | awk '/boot time/') 

And another alternative, by using dmesg(1) with the -T argument to render the timestamp in human readable format and search for the Command Line pattern.

The Command Line pattern line indicate the Kernel boot command line and the timestamp in the kernel ring buffer which gives the system boot time:

$ dmesg -T|grep -i 'Command line'|head -1 

These approachs will work on every Linux systems, not only Ubuntu distribution. Finally, the best portable way is using who -b has mentioned previously because it’s portable across systems such as Linux, Unix, OSX and FreeBSD.

Источник

Find Out How Long Does it Take To Boot Your Linux System

When you power on your system, you wait for the manufacturer’s logo to come up, a few messages on the screen perhaps (booting in insecure mode), Grub screen, operating system loading screen and finally the login screen.

Читайте также:  Boot flash linux mint

Did you check how long did it take? Perhaps not. Unless you really need to know, you won’t bother with the boot time details.

But what if you are curious to know long long your Linux system takes to boot? Running a stopwatch is one way to find that but in Linux, you have better and easier ways to find out your system’s start up time.

Checking boot time in Linux with systemd-analyze

Find out Linux Boot Time

Like it or not, systemd is running on most of the popular Linux distributions. The systemd has a number of utilities to manage your Linux system. One of those utilities is systemd-analyze.

The systemd-analyze command gives you a detail of how many services ran at the last start up and how long they took.

If you run the following command in the terminal:

You’ll get the total boot time along with the time taken by firmware, boot loader, kernel and the userspace:

Startup finished in 7.275s (firmware) + 13.136s (loader) + 2.803s (kernel) + 12.488s (userspace) = 35.704s 
graphical.target reached after 12.408s in userspace

As you can see in the output above, it took about 35 seconds for my system to reach the screen where I could enter my password. I am using Dell XPS Ubuntu edition. It uses SSD storage and despite of that it takes this much time to start.

Not that impressive, is it? Why don’t you share your system’s boot time? Let’s compare.

You can further breakdown the boot time into each unit with the following command:

This will produce a huge output with all the services listed in the descending order of the time taken.

 7.347s plymouth-quit-wait.service 6.198s NetworkManager-wait-online.service 3.602s plymouth-start.service 3.271s plymouth-read-write.service 2.120s apparmor.service 1.503s [email protected] 1.213s motd-news.service 908ms snapd.service 861ms keyboard-setup.service 739ms fwupd.service 702ms bolt.service 672ms dev-nvme0n1p3.device 608ms [email protected]:intel_backlight.service 539ms snap-core-7270.mount 504ms snap-midori-451.mount 463ms snap-screencloud-1.mount 446ms snapd.seeded.service 440ms snap-gtk\x2dcommon\x2dthemes-1313.mount 420ms snap-core18-1066.mount 416ms snap-scrcpy-133.mount 412ms snap-gnome\x2dcharacters-296.mount

Please keep in mind that the services run in parallel.

Bonus Tip: Improving boot time

If you look at this output, you can see that both network manager and plymouth take a huge bunch of boot time.

Plymouth is responsible for that boot splash screen you see before the login screen in Ubuntu and other distributions. Network manager is responsible for the internet connection and may be turned off to speed up boot time. Don’t worry, once you log in, you’ll have wifi working normally.

sudo systemctl disable NetworkManager-wait-online.service

If you want to revert the change, you can use this command:

sudo systemctl enable NetworkManager-wait-online.service

Now, please don’t go disabling various services on your own without knowing what it is used for. It may have dangerous consequences.

Now that you know how to check the boot time of your Linux system, why not share your system’s boot time in the comment section?

Источник

How to determine boot time?

I am just curious to know the time taken by my system to boot. In Arch Linux there is something like systemd-analyze . What is the alternative in Ubuntu?

Читайте также:  Линукс просмотр файла терминал

systemd is available since 15.10 version, 14.04 still relies on upstart. So you may use that command in versions 15.10 and up

+1 because I see this as a better question and more clear than similarly existing one; Existing question had zero votes and its answers are either incomplete or not useful.

4 Answers 4

Right after boot, run dmesg command. It shows you what you want.

Yes, except dmesg may contain other messages, for example I have in my dmesg right now a line dated [ 6467.1448 ] which is about 100 minutes after my boot. Point is that dmesg not meant specifically for boot. In between the system ready and user logging in, there may be extra message which wont tell reliable amount of time system booted

Without installing any software, you can use uptime , a native linux command, which serves to show how long computer has been running. The uptime command executed right after you boot the system will give you a general idea. However, it will take you extra seconds to enter password and login. Better approach would be to set calling uptime > /opt/BOOT.txt as part of lightdm startup script. It will be executed once the login screen shows up.

To do that , open or create /etc/lightdm/lightdm.conf file with root permissions.

It should contain the following lines:

[SeatDefaults] greeter-setup-script=uptime > /opt/BOOT.txt 

After your next reboot there will be file /opt/BOOT.txt which will tell you how long system has been up.

Alternatively you could read /proc/uptime where the first entry is uptime in seconds

Источник

How to Get Boot Time and Uptime on Ubuntu

You can further correlate the reboot you want to diagnose with system messages. For CentOS/RHEL systems, you’ll find the logs at /var/log/messages while for Ubuntu/Debian systems, its logged at /var/log/syslog . You can simply use the tail command or your favorite text editor to filter out or find specific data.

Who am I command line?

whoami command is used both in Unix Operating System and as well as in Windows Operating System. It is basically the concatenation of the strings “who”,”am”,”i” as whoami. It displays the username of the current user when this command is invoked. It is similar as running the id command with the options -un.

How do I check my system uptime?

  1. Bring up the Task Manager by right-clicking the clock in the lower-right corner of the taskbar and selecting Task Manager. Alternately, you could press CTRL + ALT +Delete.
  2. Select the “Performance“ tab. .
  3. You can see system uptime located toward the bottom of the window.

How can I tell what system a user rebooted?

3 Answers. You can use » last » to check. It shows when was the system rebooted and who were logged-in and logged-out. If your users have to use sudo to reboot the server then yo should be able to find who did it by looking in the relevant log file.

What is system boot time?

The time it takes for a device to be ready to operate after the power has been turned on. See boot.

Читайте также:  Основное назначение функции linux

How do I investigate a Linux server reboot?

First, you want to check /var/log/syslog . If you are not sure what to look for, you can start by looking for the words error , panic and warning . You should also check root-mail for any interesting messages that might be related to your system crash. Other logfiles you should check is application error-logs.

Where are Linux server logs?

Some of the most important Linux system logs include: /var/log/syslog and /var/log/messages store all global system activity data, including startup messages. Debian-based systems like Ubuntu store this in /var/log/syslog , while Red Hat-based systems like RHEL or CentOS use /var/log/messages . /var/log/auth.

How do I restart Linux?

To reboot Linux using the command line: To reboot the Linux system from a terminal session, sign in or “su”/”sudo” to the “root” account. Then type “ sudo reboot ” to reboot the box. Wait for some time and the Linux server will reboot itself.

Spanish School Ditches Windows For Ubuntu

School

Latest in the trend is a Spanish school that has opted Ubuntu to replace Windows operating system on 120 school computers.It happened a year back when.

Find Large Files in Linux

File

The procedure to find largest files including directories in Linux is as follows:Open the terminal application.Login as root user using the sudo -i co.

Setting Up Python Environments In Linux and Unix Systems

Python

How do you set up a Python environment?How do I change the Python environment in Linux?How do I create a Python project in Linux?Which environment sho.

Latest news, practical advice, detailed reviews and guides. We have everything about the Linux operating system

Источник

How to Get Boot Time and Uptime on Ubuntu

Ubuntu Uptime

As an Ubuntu system Administrator, you might want to know since when the system is running. This is especially helpful if you want to troubleshoot power or scheduling related problems. Although there are many open-source applications that you can install and use for this purpose, the Ubuntu ‘uptime’ command is the simplest to use and gives accurate results.

So how do we get the exact boot time and system uptime on Ubuntu? This article explains the usage of the uptime command to achieve this task.

We have run the commands on an Ubuntu 18.04 LTS system.

You can open the Terminal application either through the system Dash or the Ctrl+Alt+T shortcut.

Checking Uptime and Boot Time

Run the following command in order to view the time duration since your Ubuntu system is powered on and running(uptime):

Get Ubuntu Uptime

The output displays the time, in hours and minutes and also if 2 or more users are logged in.

Run the following command in order to view the time at which your system was booted(boot time):

Get boot time

The output displays the date and time at which your system was booted.

Hope this article and the very simple uptime command helps you with all the troubleshooting related to your power and scheduling issues!

About This Site

Vitux.com aims to become a Linux compendium with lots of unique and up to date tutorials.

Latest Tutorials

Источник

Оцените статью
Adblock
detector