OSXDaily has a great tip on how to access iCloud Drive in Terminal. If you prefer the Terminal over the GUI, or just want a different way to create and move files and folders, this is the tip for you.
[macOS: Use Clipboard in Terminal Without a Mouse]
iCloud Drive in Terminal
First, we’ll need to know the file path of iCloud Drive:
Now, to navigate to iCloud Drive, we’ll be using the CD command, like so:
cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/
You can use the command “ls” to get a list of the folders in each directory.
Now in order to copy files to iCloud Drive, you can use the “cp” command:
cp ~/Desktop/filename.zip ~/Library/Mobile\ Documents/com~apple~CloudDocs/
If you’ve already navigated to iCloud Drive, you’ll have to change directories to copy files. That’s what the CD command is. So before you copy a file to iCloud Drive, move back to your user directory:
Then you can copy a file with the previous command. It’s a bit confusing if you’re not used to Terminal.