There are 2 files but yet there are 40 files. (And other file syncing questions.)

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
purpletree
Level 1
Level 1
Posts: 22
Joined: Tue Apr 10, 2018 12:55 am

There are 2 files but yet there are 40 files. (And other file syncing questions.)

Post by purpletree » Fri Apr 20, 2018 4:42 pm

I'm using a file syncing service called SpiderOak and it constantly has issues with syncing certain kinds of files.
One example of "a bad choice to backup" are KeePassX database files. I assume it's the lock files that are the problem.
When I was taking a look at the directory in which I store my KeePassX (*.kdbx) files in I ran into something I don't understand:
When viewing the directory with Dolphin, I only see two files. Fine, it doesn't show hidden files...
When viewing the directory using Terminal with

Code: Select all

ls -la
it reports this:
total 40
drwxrwxrwx 2 enks enks 4096 Apr 20 14:15 .
drwxrwxrwx 4 enks enks 4096 Apr 19 18:47 ..
-rw------- 1 enks enks 58 Apr 14 02:05 .directory
-rw-rw-rw- 1 enks enks 4094 Apr 10 14:18 Passwords_D.kdbx
-rw-rw-rw- 1 enks enks 19310 Apr 19 11:35 Passwords.kdbx
-rw-r--r-- 1 enks enks 24 Apr 20 14:15 .Passwords.kdbx.lock
I'm new to linux and I'm motivated to understand what's going on, can someone explain this?
Why are there 40 files? (2+4+1+1+1+1 = 10)
How can I see these other files?
Why are there . and ..?
What does the .directory file do?
And what's with the permissions?

User avatar
phd21
Level 19
Level 19
Posts: 9518
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: There are 2 files but yet there are 40 files. (And other file syncing questions.)

Post by phd21 » Fri Apr 20, 2018 5:10 pm

HI purpletree

Welcome to the wonderful world of Linux Mint and its excellent forum!

Any files or folders that start with a period (dot) are "hidden" files and folders. The file managers like Dolphin can show hidden files as well, click View and Hidden files, or add the Hidden files button to its toolbar to toggle that off and on.

The first two items are almost always part of a folder and subfolder "." (current folder directory) and ".." (one folder up from current folder). If I remember correctly, that is the same with MS Windows.

The hidden lock file is created when you are in an application due to file locking to protect it. If you had to abort the application program or forcibly restart (reboot) your system, then sometimes the lock files will remain and can be safely deleted.

I do not see 40 files in your results? That is probably the total bytes (size) of the files.

ExcIuding the "." and "..", I only have three in my "/Documents/kp" folder where I store the KeePassX database files, it only shows 2 files if I run "ls -lh".
>ls -lha
total 348K
drwxrwxr-x 2 user69 user69 4.0K Apr 20 16:54 .
drwxr-xr-x 32 user69 user69 4.0K Apr 20 14:41 ..
-rw-r--r-- 1 user69 user69 240 May 19 2017 (conflicted).directory
-rw-r--r-- 1 user69 user69 269 Apr 20 16:54 .directory
-rw------- 1 user69 user69 332K Mar 23 22:23 something.kdbx

or

ls -lh
total 336K
-rw-r--r-- 1 user69 user69 240 May 19 2017 (conflicted).directory
-rw------- 1 user69 user69 332K Mar 23 22:23 something.kdbx
Linux is a very secure operating system and has "permissions" assigned to folder and files for user(s) access and "root" superuser access.

I also use 3 different cloud providers and their Linux software clients, excellent "pCloud", excellent "Mega.nz", and Google's Drive using the superb "InSync" client, to sync my stuff like KeePassX database files, AutoKey shortcut folders, etc... This will occasionally create a conflicted directory folder entry which I usually delete, I am not sure why.

What do the fields in ls -al output mean? - Unix & Linux Stack Exchange
https://unix.stackexchange.com/question ... utput-mean

what means a dot after the file permission ?
https://www.linuxquestions.org/question ... on-796947/

ls command in Linux/Unix | list files/directories
https://www.rapidtables.com/code/linux/ls.html


Hope this helps ...
Last edited by phd21 on Fri Apr 20, 2018 5:20 pm, edited 2 times in total.
Phd21: Mint 19.2 Cinnamon & xKDE (Xfce) & KDE Neon 64-bit Awesome OS's, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram, 256gb SDD, only Intel 4 Graphics. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

Cosmo.
Level 23
Level 23
Posts: 17830
Joined: Sat Dec 06, 2014 7:34 am

Re: There are 2 files but yet there are 40 files. (And other file syncing questions.)

Post by Cosmo. » Fri Apr 20, 2018 5:17 pm

. stands for the current directory, .. for the parent directory. You can for example enter the command cd .. and you get a hierarchy level higher. if you use the option -A instead of -a they will not get shown. If they are shown they user has the ability to check their permissions.

The permissions are as that: There are 10 columns. The first one shows d, if the object is a directory, otherwise it is empty (= -) This is not a permission, but the other 9 columns show permissions. Divide them in 3 groups. Column 1 to 3 show the permissions of the owner, the next 3 for the group members and the last 3 for the rest of the world. Column 1 / 4 / 7 says r, if there is a read permission (or - for no read permission), 2 / 5 / 8 an w for write permission, 3 / 6 / 9 an x for execution permission.

The kdbx.lock file exists, as long as the corresponding KPX database is opened. This is for preventing, that it gets erroneously double opened, which could easily destroy the data. As soon as the database gets closed, the lock file gets deleted. There is no sense to back it up.

You seem to have 2 databases, the second one is currently in use.

purpletree
Level 1
Level 1
Posts: 22
Joined: Tue Apr 10, 2018 12:55 am

Re: There are 2 files but yet there are 40 files. (And other file syncing questions.)

Post by purpletree » Fri Apr 20, 2018 5:25 pm

Thank you. So one thing I immediately notice is that with the -h flag there's a K after the number. I though it was a count of how many files are there but you're right, it's for the size of the directory.

User avatar
phd21
Level 19
Level 19
Posts: 9518
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: There are 2 files but yet there are 40 files. (And other file syncing questions.)

Post by phd21 » Fri Apr 20, 2018 5:34 pm

Hi purpletree,

You are welcome from all of us that replied...
Phd21: Mint 19.2 Cinnamon & xKDE (Xfce) & KDE Neon 64-bit Awesome OS's, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram, 256gb SDD, only Intel 4 Graphics. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

User avatar
slipstick
Level 5
Level 5
Posts: 943
Joined: Sun Oct 21, 2012 9:56 pm
Location: Somewhere on the /LL0 scale

Re: There are 2 files but yet there are 40 files. (And other file syncing questions.)

Post by slipstick » Fri Apr 20, 2018 5:54 pm

A little more about permissions (from the book "The Linux Command Line" by William Shotts) - free pdf download here:
http://linuxcommand.org/tlcl.php
Screenshot_permissions.png
In theory, theory and practice are the same. In practice, they ain't.

purpletree
Level 1
Level 1
Posts: 22
Joined: Tue Apr 10, 2018 12:55 am

Re: There are 2 files but yet there are 40 files. (And other file syncing questions.)

Post by purpletree » Fri Apr 20, 2018 11:48 pm

Thanks again everyone. That was exceptionally helpful.

Mute Ant
Level 14
Level 14
Posts: 5135
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: There are 2 files but yet there are 40 files. (And other file syncing questions.)

Post by Mute Ant » Sat Apr 21, 2018 11:16 am

find -type f | wc -l ### Report the number of real file objects in-or-below this folder where I am now.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".

Post Reply

Return to “Newbie Questions”