Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
4  
I object: this is important. –  Agos Jun 27 '11 at 22:50
add comment

7 Answers 7

up vote 32 down vote accepted

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
    
share|improve this answer
    
To see when the users logged in the last time, use lastlog. For login failures, use faillog. Note that these programs (including last) make use of log files, notably: /var/log/wtmp (last), /var/log/lastlog (lastlog) and /var/log/faillog (faillog). –  Lekensteyn Jun 27 '11 at 19:01
1  
+1 for writing a detailed answer. –  AttackingHobo Jun 28 '11 at 2:17
add comment

In the terminal write :

uptime

share|improve this answer
2  
What about machines that stay up for days? –  Marco Ceppi Jun 27 '11 at 18:18
2  
days!? how about years? :-D –  Rinzwind Jun 27 '11 at 18:21
    
lol ...my bad :D! –  Binarylife Jun 27 '11 at 18:25
    
@MarcoCeppi: from my machine: "20:55:04 up 8 days, 17:29, 18 users, load average: 1.89, 1.85, 1.90". This is not a server, I just put it in suspend. Those "18 users" refer to terminals, I'm the only user of the system =] There is no such thing as "up 2 years", it'll show something like "up 756 days". @binarylife: If you want to parse it, be sure to look in the source code of uptime to prevent making mistakes –  Lekensteyn Jun 27 '11 at 18:57
1  
@Lekensteyn I'm aware of how days are counted. Oldest server up is 834 days :) Was just pointing it out to @binarylife that there are also days included in uptime count –  Marco Ceppi Jun 27 '11 at 19:07
show 3 more comments

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

share|improve this answer
add comment

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

share|improve this answer
3  
...and even crashes: "user pts/4 :0 Mon Jun 6 15:13 - crash (1+17:30)" –  Lekensteyn Jun 27 '11 at 19:12
add comment

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.
share|improve this answer
    
a video of zeitgeist in action looks preety good. youtube.com/watch?v=g1D95YR3aVE –  Vitaly Jun 27 '11 at 19:24
1  
sudo apt-get install zeitgeist sudo apt-get install gnome-activity-journal –  Vitaly Jun 27 '11 at 19:26
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
    
nice the app is preety slick thnx –  Vitaly Jun 27 '11 at 19:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.