4

If I was logged into my user account, then how can I check the login details such as date, time etc using terminal? Also please tell me, if I want to check the log details of the previous month or year or from x month to y month etc.

SRJ577
  • 105
  • hello Sergiy, thank you for your attention and edit. Actually what I meant was to check the log details from a certain period of time such as from x month to y month or of the previous year like that. – SRJ577 Aug 22 '18 at 07:16
  • Could you please notify me in the comments when this question is reopened? I’ll write a proper answer based on https://askubuntu.com/a/959078/175814 and/or https://gist.github.com/davidfoerster/c35afe1c62f1468205a6f56b0cb9b44b. – David Foerster Aug 22 '18 at 11:11

2 Answers2

2

last command will help you to see user logins and restarts.

enter image description here

cat /var/log/auth.log | grep session command will give you more details.

enter image description here

dedunu
  • 9,186
  • can I get the details by giving from and to? – SRJ577 Aug 21 '18 at 12:04
  • @SRJ577 There is an answer to that but I think you will have to ask a separate question as this one has been locked down as a duplicate with an answer (which doesn't include your supplementary) – graham Aug 21 '18 at 13:37
  • Please don't post screenshots of text. Copy the text here and apply code formatting instead. – muru Aug 22 '18 at 07:38
1

In Linux system there is folder /var/log where all system generated log files get saved. You can use this by

tail /var/log/auth.log  
tail /var/log/syslogs

You can also use command w to get login details.

Dev
  • 176