Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-16-2017, 02:27 AM
|
#1
|
Senior Member
Registered: Jan 2015
Posts: 1,432
Rep:
|
Recent files in Linux.
Hello.
Has Linux any recent files? I like to know when I'm not at the desk then which files viewed by others.
Thank you.
|
|
|
07-16-2017, 03:08 AM
|
#2
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,286
|
If you are not at your machine, no-one should be able to access anything.
What did you web search return ?.
|
|
1 members found this post helpful.
|
07-16-2017, 04:42 AM
|
#3
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,280
|
at first you can lock your computer, so noone can use it without your password.
Next, nowadays the PCs connected to the network, so one can reach your PC without sitting at your desk.
finally the system (running programs) may write files anywhere (like logs or anything else) without a keypress, without logged in users (human beings).
|
|
|
07-16-2017, 04:52 AM
|
#4
|
Member
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229
Rep:
|
You can find recently accessed files with, what a surprise, find command. For example:
Code:
find . -user username -type f -amin -60
will show you all files, but not directories, owned by username that were accessed in the last 60 min in working directory. Instead of that . use path to directory that you wish to examine. For some more insight of how find command works, you can read man page, or/and visit this page: https://www.tecmint.com/35-practical...-find-command/.
Last edited by dejank; 07-16-2017 at 04:54 AM.
|
|
2 members found this post helpful.
|
07-17-2017, 02:17 AM
|
#5
|
Member
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567
|
Yup, you can do this easily with the find command. There are a few flavours for the access times and modified times:
Code:
find $HOME -type f TIME_ARG
### TIME_ARG can be (for example):
-amin -120
file was last accessed less than 120 minutes ago. The "less than" is indicated by the minus sign in front of the number.
-atime -1
file was last accessed less than 1 day ago.
-mmin -45
file was last modified less than 45 minutes ago.
-mtime -0.5
file was last modified less than half a day ago (less than 12 hours).
But as syg00 said, no one should be accessing your files when you're not there. Create separate user profiles for every user, set password and encrypt your home directory.
|
|
|
07-18-2017, 02:11 AM
|
#6
|
Senior Member
Registered: Dec 2011
Location: Simplicity
Distribution: Mint/MATE
Posts: 2,988
|
The atime works in Unix only.
In Linux since kernel 2.6.30 the default mount option is relatime, so find -amin and ls -lu are not reliable.
The atime is updated if it were off by more than 1 day, so frequent access can still be seen with -atime -1.
If you want to use reliable atime in Linux you need to explicitly mount with option strictatime.
Last edited by MadeInGermany; 07-24-2017 at 12:50 PM.
Reason: spelling
|
|
|
07-23-2017, 02:05 AM
|
#7
|
Senior Member
Registered: Jan 2015
Posts: 1,432
Original Poster
Rep:
|
I opened a file but "find $HOME -type f -amin 1" not show it !!!
Code:
$ find $HOME -type f -amin 1
/home/mohsen/.config/google-chrome/Default/Preferences
/home/mohsen/.config/google-chrome/Local State
/home/mohsen/.config/dconf/user
|
|
|
07-23-2017, 03:31 AM
|
#8
|
Member
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229
Rep:
|
Quote:
Originally Posted by hack3rcon
I opened a file but "find $HOME -type f -amin 1" not show it !!!
Code:
$ find $HOME -type f -amin 1
/home/mohsen/.config/google-chrome/Default/Preferences
/home/mohsen/.config/google-chrome/Local State
/home/mohsen/.config/dconf/user
|
You want -amin -1, not -amin 1. Read man page of find, please. There is explanation there for time units and difference between +n, -n and n.
|
|
|
07-24-2017, 05:21 AM
|
#9
|
Senior Member
Registered: Apr 2010
Posts: 2,283
|
|
|
1 members found this post helpful.
|
07-26-2017, 03:35 AM
|
#10
|
Senior Member
Registered: Jan 2015
Posts: 1,432
Original Poster
Rep:
|
Quote:
Originally Posted by JJJCR
|
Thank you. Below command shows me the result that I wanted.
Code:
$ sed -nr 's/.*href="([^"]*)".*/\1/p' ~/.local/share/recently-used.xbel
|
|
|
All times are GMT -5. The time now is 06:27 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|