Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 02-02-2007, 05:24 PM   #1 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,685

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default How do you use spaces with terminal?

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.
__________________

Need website help? PM me!
CrazeD is offline  
Old 02-02-2007, 05:52 PM   #2 (permalink)
 
Super Techie

Join Date: Jul 2004

Posts: 375

Nikkon

Default

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.)
__________________
AMD 3800+ X2
Zalman CNPS7000B CPU Heatsink/Fan
ASUS A8N Premium
2 GB G. Skill DDR 400 (2 X 1 GB)
1 GB Ultra DDR 400 (2 X 512 GB)
eVGA 7800GT 256MB
120 GB seagate HD (7200RPM)
80 GB Seagate HD (7200RPM)
Sound Blaster Audigy 2 Platium ZS Sound Card
Logitec z5300 5.1 THX certified speaker
Medusa 5.1 Headphones
ATI TV turner card
DVD Drive
CD Burner Drive
Razer Copperhead Gaming mouse
Nikkon is offline  
Old 02-02-2007, 06:01 PM   #3 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,685

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default

Sweet, thanks.

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


__________________

Need website help? PM me!
CrazeD is offline  
Old 02-02-2007, 09:16 PM   #4 (permalink)
macdude425's Avatar
 
Member (again)

Join Date: Jan 2005

Location: Raul's Wild Kingdom...How 'bout that, huh?

Posts: 4,200

macdude425 is on a distinguished road

Send a message via AIM to macdude425 Send a message via Yahoo to macdude425
Default

Easier method.

"rm file*one"
__________________



Debian Support Forums!
macdude425 is offline  
Old 02-03-2007, 12:17 AM   #5 (permalink)
 
Super Techie

Join Date: Jul 2004

Posts: 398

kostas

Default

or put quotes around the whole file path/name
__________________

kostas is offline  
Old 02-03-2007, 12:53 AM   #6 (permalink)
 
Banned

Join Date: Sep 2005

Posts: 5,191

The General

Default

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$
Does this make sense to you? I made the file with touch, then removed it. The \ will disregard the next character ...

Meh..
The General is offline  
Old 02-03-2007, 01:09 AM   #7 (permalink)
 
True Techie

Join Date: May 2006

Posts: 101

jonmon6691

Default

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"
__________________
<small>
.:HP Pavillion dv6000:.
1.8 ghtz Intel Core 2 Duo
2GB RAM
120 GB HDD
nVidia Go graphics
Apache 2.2 (looking for a domain name)
</small>
jonmon6691 is offline  
Old 02-03-2007, 01:17 AM   #8 (permalink)
 
Banned

Join Date: Sep 2005

Posts: 5,191

The General

Default

Quote:
Originally 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"
With mine, I add 1 symbol, with yours you add 2. How is yours simpler than mine?
The General is offline  
Old 02-04-2007, 07:28 PM   #9 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,685

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default

Quote:
Originally posted by The General
With mine, I add 1 symbol, with yours you add 2. How is yours simpler than mine?
He's saying it would be easier to use quotes if there is a say more than one space.

Either way works, thanks guys.
__________________

Need website help? PM me!
CrazeD is offline  
Old 02-05-2007, 01:09 PM   #10 (permalink)
 
Master Techie

Join Date: Apr 2004

Posts: 2,534

horndude is on a distinguished road

Default

the "\" character is the escape character
horndude is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On