LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   directory creation (https://www.linuxquestions.org/questions/linux-general-1/directory-creation-4175675210/)

marius09 05-14-2020 07:56 AM

directory creation
 
hi,
i like to know why after i login to a new user account the date of user home directory change?

useradd y32
ls -ld /home/y32
drwx------. 2 y32 y32 62 May 14 04:39 /home/y32

ssh y32@192.168.30.105
y32@192.168.30.105's password:
Last login: Thu May 14 04:44:08 2020 from 192.168.30.105
[y32@test5 ~]$ logout
Connection to 192.168.30.105 closed.
ls -ld /home/y32
drwx------. 2 y32 y32 83 May 14 04:44 /home/y32

shruggy 05-14-2020 08:11 AM

.bash_history gets updated? No, crap, must be something else. BTW, on my system geany and gedit-plugin-terminal require VTE which installs /etc/profile.d/vte.sh which, in turn, sets PROMPT_COMMAND thusly:
Code:

$ echo $PROMPT_COMMAND
history -a; history -n; printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"

Quote:

directory creation
The thread name is wrong. What ls -l shows by default is the modification time (mtime). It's the time of the last write.

Use ls -cl to display the status change time (ctime) instead. It changes e.g. when the file gets moved/renamed or its ownership/permissions are changed.

Use stat %w to display the file creation time (birthtime).

From the GNU Coreutils manual:
Quote:

Naively, a file’s atime, mtime, and ctime are set to the current time whenever you read, write, or change the attributes of the file respectively, and searching a directory counts as reading it. A file’s atime and mtime can also be set directly, via the touch command (see touch invocation). In practice, though, timestamps are not updated quite that way.

For efficiency reasons, many systems are lazy about updating atimes: when a program accesses a file, they may delay updating the file’s atime, or may not update the file’s atime if the file has been accessed recently, or may not update the atime at all. Similar laziness, though typically not quite so extreme, applies to mtimes and ctimes.

ondoho 05-14-2020 04:23 PM

The same happens on my system.
Funny, I never noticed it before.
Currently 'ls -ald ~' shows May 15 00:13 which is definitely hours after I logged in.

I don't see anything problematic with that.

shruggy 05-15-2020 03:26 AM

I guess I got it.
Quote:

Originally Posted by marius09 (Post 6122804)
after i login to a new user account

Quote:

Originally Posted by shruggy (Post 6122813)
.bash_history gets updated?

Not updated, but created.

ondoho 05-16-2020 02:28 AM

^ yeah, I guess it changes every time some file is created or deleted in $HOME:
Code:

$> ls -ald ~
drwx------ 25 ondoho ondoho 4.0K May 16 10:00 /home/ondoho/
$> touch yadda
$> ls -ald ~
drwx------ 25 ondoho ondoho 4.0K May 16 10:22 /home/ondoho/
...wait a few minutes...
$> rm yadda
$> ls -ald ~
drwx------ 25 ondoho ondoho 4.0K May 16 10:24 /home/ondoho/

It does NOT change when you just modify the file:
Code:

$> ls -al yadda
-rw-r--r-- 1 ondoho ondoho 0 May 16 10:25 yadda
$> touch yadda
$> ls -al yadda
-rw-r--r-- 1 ondoho ondoho 0 May 16 10:26 yadda
$> ls -ald ~
drwx------ 25 ondoho ondoho 4.0K May 16 10:25 /home/ondoho/



All times are GMT -5. The time now is 07:14 PM.