How to enter alt key codes in a Linux BASH shell

I'm using ssh in a rsync script.  I'm trying to transfer files from a folder name which has spaces in the name:

rsync -avz -e "ssh -i local-rsync-key /<mybackupdir> backup@<remoteIP>:/datafiles/folder name with space/*"

SSH is having trouble understanding the spaces.  I want to use an alt-key-combination such as  ALT-0255 on the keypad to enter a space, but I can't quite figure out how to do that in the BASH shell in linux.

LVL 3
thomaswrightAsked:
Who is Participating?
 
ahoffmannConnect With a Mentor Commented:
rsync -avz -e "ssh -i local-rsync-key /<mybackupdir> backup@<remoteIP>:'/datafiles/folder name with space/\*'"

# not sure if you need the \ infronmt of *, it may depend of on your OS and/or shell on the remote system.
You better get rid of spaces in file and directory names ...
0
 
hernst42Commented:
try correct quoting like:
rsync -avz -e "ssh -i local-rsync-key"  /<mybackupdir> "backup@<remoteIP>:/datafiles/folder name with space/*"
then it should work also with spaces
0
 
omarfaridCommented:
You may use single quotes around the folder name
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
thomaswrightAuthor Commented:
You got me on the right track. Thanks!
0
 
thomaswrightAuthor Commented:
The proper syntax for the solution is

sync -avz -e "ssh -i local-rsync-key /<mybackupdir> backup@<remoteIP>:'/datafiles/folder name with space/'*"

Note: Notice the single quotes surrounding the entire path.
0
 
thomaswrightAuthor Commented:
Correction!: I forget a double quote before @backup:

This works:

sync -avz -e "ssh -i local-rsync-key /<mybackupdir> "backup@<remoteIP>:'/datafiles/folder name with space/'*"
0
 
thomaswrightAuthor Commented:
I also forgot the destination path, so its:

rsync -avz -e "ssh -i local-rsync-key /<mybackupdir> "backup@<remoteIP>:'/datafiles/folder name with space/'*" /<destinationpath>/
0
All Courses

From novice to tech pro — start learning today.