A systems administrator needs to free space on /home by moving a 5-GB ISO image named vm.iso into /var/isos/. The file must disappear from /home immediately after the operation and its ownership, permissions, and timestamps must remain unchanged. Which single Linux command accomplishes this requirement in one step?
ln -s /home/vm.iso /var/isos/
cp -a /home/vm.iso /var/isos/ && rm -f /home/vm.iso
The mv command moves (renames) a file or directory. Within the same filesystem it simply updates the directory entry that points to the inode, so no duplicate is left behind. Using the -p option preserves the file's mode, ownership, and timestamps, meeting the administrator's metadata requirement. Commands that use cp would create a second copy until the original is removed, and ln -s only creates a link, leaving the data in /home.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
How does the mv command differ from the cp command?
Open an interactive chat with Bash
What happens to the inode when you use the mv command?
Open an interactive chat with Bash
Can you use the mv command to rename directories as well?