I know in the man pages it puts it as -x, --one-file-system stay on this file system
but can someone explain it to me like I'm five.
4 Answers
cp -ax
,rsync -x
or tar -one-file-system
, all are the same.
It means not to cross file system boundaries.
A boundary between file systems is a mount point.
If you run df -a
, you will see all files and mount points.
To help you understand with an example:
If you run df
on your filesystem: df /
, or on /usr directory: df /usr
, you will see that they are mounted on /
, your installation partition. But if you run it on /proc df /proc
you will see that the mount point is different.
So if you issue a recursive copy on your filesystem cp -ax /
, it won't copy /proc
directory.
You could add -v
option if you want to see exactly what is discarded and what is being copied.
As others pointed out, it's used with recursive and people generally use it for backup.
And you should see "Meaning of crossing filesystem boundaries" for more on mount points.

- 381
That makes a difference if you use cp
with recursion i.e. with -r
or -a
and the source is above a mount point.
E.g.: /data/job/encrypt
is an active mount point.
cp -a /data/job /path/to/target # includes /data/job/encrypt
cp -ax /data/job /path/to/target # excludes /data/job/encrypt

- 90,279
From my understanding it means it will only copy things on the currently running filesytem, and not from another one that may be present
Example. If you mounted another filesystem (another physical disk, usb or remote filesystem) under /home/jkris/mnt/otherfs and then proceeded to
cp -ax /home/jkris/ /mybackup/dir/
It would not copy anything from ~/mnt/otherfs
Similar question and answer here: https://superuser.com/questions/307541/copy-entire-file-system-hierarchy-from-one-drive-to-another
To specify that the data to be copied is an executable, we use this command cp -X on the USS mainframe part.
I hope this helps.
-
1This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review – Peregrino69 Feb 24 '23 at 20:37