[How do you use spaces with terminal?] - Computers



Search Tech-Forums - link takes you to our Forum's search page.

Note: The following is only a text archive!


To view the actual forum discussion, please visit our website at http://www.tech-forums.net

Pages:1



How do you use spaces with terminal?

(Click here to view the original thread with full colors/images)



Posted by: CrazeD

I got Ubuntu 6.06 32-bit on my spare machine just to screw around with it. It's pretty cool so far, and I'm currently learning all the bash commands.

So, with bash, how do you work in a space in a file?

Example: Say I want to delete the file "file one". I can do "rm file one" but that counts it as deleting two files named "file" and "one".

I hope you understand my question. :)



Posted by: Nikkon

I dont remeber the exact escape sequence for space, but you can always hit the TAB key to auto-fill out the closest file name. (ie type -> "rm file" then hit the TAB key.)



Posted by: CrazeD

Sweet, thanks.

By hitting TAB I have learned that you would type "rm file\ one/".

:)



Posted by: macdude425

Easier method.

"rm file*one"



Posted by: kostas

or put quotes around the whole file path/name



Posted by: The General

If there's a space in the filename, just put a \ before the space, so it sort of comments it out. For example:

[code]ted-roddys-computer:~ Ted$ ls
Desktop Library Pictures Sites
Documents Movies Public Torrents
Incomplete Music Shared vmware
ted-roddys-computer:~ Ted$ touch file\ name.txt
ted-roddys-computer:~ Ted$ ls
Desktop Library Pictures Sites vmware
Documents Movies Public Torrents
Incomplete Music Shared file name.txt
ted-roddys-computer:~ Ted$ rm file\ name.txt
ted-roddys-computer:~ Ted$ ls
Desktop Library Pictures Sites
Documents Movies Public Torrents
Incomplete Music Shared vmware
ted-roddys-computer:~ Ted$ [/code]

Does this make sense to you? I made the file with touch, then removed it. The \ will disregard the next character ...

Meh..



Posted by: jonmon6691

you guys are making this WAY harder than it is just do

$rm "file one"

the quotes arount the file make it literal, so u could do this

$rm "/home/jon boy/Desktop/File with spaces/file name.txt"



Posted by: The General

[QUOTE][i]Originally posted by jonmon6691 [/i]
[B]you guys are making this WAY harder than it is just do

$rm "file one"

the quotes arount the file make it literal, so u could do this

$rm "/home/jon boy/Desktop/File with spaces/file name.txt" [/B][/QUOTE]

With mine, I add 1 symbol, with yours you add 2. How is yours simpler than mine?



Posted by: CrazeD

[QUOTE][i]Originally posted by The General [/i]
[B]With mine, I add 1 symbol, with yours you add 2. How is yours simpler than mine? [/B][/QUOTE]

He's saying it would be easier to use quotes if there is a say more than one space.

Either way works, thanks guys.



Posted by: horndude

the "\" character is the escape character





vBulletin Copyright ©2000 - 2003, Jelsoft Enterprises Limited.


PPC Management
vB Easy Archive Final - Created by Xenon