Friday, May 3, 2024
111
rated 0 times [  111] [ 0]  / answers: 1 / hits: 553107  / 1 Year ago, tue, december 6, 2022, 6:47:57

I want to move one file to a folder using terminal. How do I do this?


More From » command-line

 Answers
0
mv [file] [directory]


For example, to move info.txt from the actual directory into the config/ directory, type mv info.txt config/






As was pointed out in a correct comment, the above will fail if the user running the command doesn't have write access to either the file or the folder.



If you prefix the command with sudo, you are telling the system to run the command as the root user (similar to an Admin account). Example:



sudo mv info.txt config/


BIG IMPORTANT NOTE:

Only use sudo if you are sure you know what you're doing - Ubuntu protects things for a reason. Using sudo you can break your OS, forcing a reinstall, if you move (or delete or whatever) important files.


[#25224] Wednesday, December 7, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
egantfis

Total Points: 406
Total Questions: 108
Total Answers: 108

Location: Austria
Member since Thu, Jan 7, 2021
3 Years ago
;