See computer's uptime and history

I was wondering if it is at all possible to find out when the computer was switched on, what files where accessed what folders were opened, what programs run and when the computer was resumed and put back to sleep (just like in the movies).

I know this isn’t that important but it would be cool to know.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

When was the machine turned on:

uptime

Example from my notebook:

20:06:33 up  1:50,  2 users,  load average: 0.03, 0.04, 0.05

That is current time, uptime, amount of users and the load average.

What programs run:

  • Command line

    ps -ef|more
    

    enter image description here

  • GUI – System monitor (dash, system monitor):

    enter image description here

When the computer was resumed or sleep

last

enter image description here

what folders were opened

what files where accessed

None of these I know a command for. Natty has activity journal for files.

Other interesting things…

  • To see when the users logged in the last time: lastlog.

    enter image description here

  • Login failure: faillog.

    last, lastlog, faillog make use of log file /var/log/wtmp (last), /var/log/lastlog and /var/log/faillog. If those are not active you will not get any result.

  • lsof shows a list of currently open files.

    enter image description here

    It can do alot of checks on a lot of options. From man lsof:

    To list all open IPv4 network files in use by the process whose PID is 1234, use:

    lsof -i 4 -a -p 1234
    

    To list all open files for login name “abe”, or user ID 1234, or process 456, or process 123, or process 789, use:

    lsof -p 456,123,789 -u 1234,abe
    

    To list all open files on device /dev/hd4, use:

    lsof /dev/hd4
    

Solution 2

You can use the last command to check on boot times, reboots, suspends/resumes.

Solution 3

A few things worth checking out :

  • uptime command to see how long your computer’s been running.
  • Gnome Log Viewer (gnome-system-log) shows all of your logs at one place.
  • Zeitgeist Activity Journal. This gives a brilliant calendar like view to show you what files were opened, and which applications were used.

Solution 4

As many have said “uptime” gives you up time.

I like to use “htop” to show me information about what’s currently running – it’s really really nicely formatted, easy for me to skim.

If you want to see who’s currently logged in, try the command “who”. You can dump messages on to their terminals by the “write” command, that can be fun.

As for seeing what’s been going on, you can check your logs, such as /var/log/syslog or /var/log/messages (depending on distro). Further, for somewhat lower-level messages, “dmesg” is helpful.

Another thing you can use to try to see history is take a look at users *~/.bash_history* (or ~/.history, etc). That file will show you a list of commands that user has recently run. I believe a user has the ability to nuke their own history file. There’s probably ways of configuring that so you can monitor more closely.

Hope that helps.

Solution 5

In the terminal write :

uptime

Solution 6

For a graphical solution, System Profiler and Benchmark (search in the Ubuntu Software Center) provides both uptime and lists all starts. I don’t know if it shows the programs that were run, although I guess I doubt it. But the program is very good for getting all sorts of information about your system, mostly hardware-related.

Solution 7

To check the uptime of a PC go to Terminal and type uptime then press enter.

Solution 8

screenfetch also works for this and provides data in a nice way.

Install it with $ sudo apt install screenfetch.

Then type screenfetch for the information.

(Note: It only shows how many hours it was turned on and other details of the system)

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply