Custom Search

How to copy a long file name from thumb drive?

When copying files and directories from thumb drive or usb drive, we always dealing with windows file. There is no problem if you are using Ubuntu desktop because you just right-click the file, copy and paste it in your Linux. In Ubuntu server we are working in the command line terminal. To copy a long file name with white space need some creativity.

Here are some tips on how to copy longer file name with white space from thumb drive/usb drive in Linux command line terminal:

We need to add a backslash at the end of every words in the file name. Here is an example on how to copy longer file with white space:

kucing@ubuntu-server:/media/disk$ ls | grep Linux

Linux copy command tutorial.txt

Linux copy windows file.txt

Linux command copy file example01.txt


Type cp and the first word in the file name:

 kucing@ubuntu-server:/media/disk$ cp Linux


Pressing the tab key wouldn't help here. What you have to do is to put a backslash after the first word:

kucing@ubuntu-server:/media/disk$ cp Linux\ 


Press spacebar to put a white space and key in the second word:

kucing@ubuntu-server:/media/disk$ cp Linux\ copy\


Repeat steps above if you have a long file name.

kucing@ubuntu-server:/media/disk$ cp Linux\ copy\ windows\ file.txt /home/tutorials/


That's it. A simple thing but can cause a headache for a Linux beginner.

No comments:

Post a Comment

Please keep comment relevant and strictly no spam will be tolerated. Thank you.