Pablo Iranzo Gómez, Pedro Ibáñez Requena, Miguel Pérez Colino, Scott McCarty - Red Hat Enterprise Linux 9 Administration-Packt Publishing (2022) -chap 3 82 - 180
md GVARIANT-SERIALIZATION HACKING NEWS README TRANSIENT- SETTINGS.md TRANSLATORS UIDS-GIDS.md You will see that running ls TR only shows files that start with TR: [user@rhel-instance mysystemd]$ ls TR* TRANSIENT-SETTINGS.md TRANSLATORS It will work the same way with the file ending: [user@rhel-instance mysystemd]$ ls *.md ENVIRONMENT.md TRANSIENT-SETTINGS.md UIDS-GIDS.md As you can see, it only shows files ending in .md. We can copy a full branch of files and directories with the recursive option for cp, which is -r: [user@rhel-instance mysystemd]$ cd
[user@rhel-instance ]$ mkdir myauthselect [user@rhel-instance ]$ cp -r /usr/share/authselect/* myauthselect [user@rhel-instance ]$ ls myauthselect/default/ minimal sssd winbind The recursive option is very useful for copying complete branches. We could also move directories or files easily using the mv command. Let’s put all our new directories together into a newly created directory called docs: [user@rhel-instance ]$ mkdir docs [user@rhel-instance ]$ mv my docs/ [user@rhel-instance ]$ ls docs/ myauthselect myawk mysystemd You can see that with mv, you do not need to use the recursive option to manage a full branch of files and directories. It can also be used to rename files or directories: [user@rhel-instance ]$ cd docs/mysystemd/ [user@rhel-instance mysystemd]$ ls 20-yama-ptrace.conf CODING_STYLE DISTRO_PORTING ENVIRONMENT. md GVARIANT-SERIALIZATION HACKING NEWS README TRANSIENT- SETTINGS.md TRANSLATORS UIDS-GIDS.md [user@rhel-instance mysystemd]$ ls -l NEWS
Listing, creating, copying, and moving files, directories, links, and hard links 87 -rw-r--r--. 1 user user 451192 Feb 16 19:59 NEWS