Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-05-2006, 04:01 PM   #1
LQ Newbie
Registered: Aug 2005
Posts: 15

Rep: Reputation: 0
terminal question

How do you type a space within the terminal so that it will be recognized? For example if I am trying to list the contents of a directory such as:

ls /home/user/The Application Folder

it always gives me the "No such file or directory" error. Like this:

ls: /home/user/The: No such file or directory
ls: Application: No such file or directory
ls: Folder: No such file or directory

I have tried using underscores to denote a space but they don't work either.
Old 05-05-2006, 04:06 PM   #2
Registered: Apr 2006
Location: holland
Distribution: Gentoo / debian / suse / mint
Posts: 558

Rep: Reputation: 42
if a file is has spaces in it . like example: first last patch.tar.gz

you can make it be recognized in the terminal by doing this:

tar zxvf first\ last\ patch.tar.gz
Old 05-05-2006, 04:43 PM   #3
LQ Newbie
Registered: Aug 2005
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks! What about if I want to edit a file with spaces in vi?

Like (example is a simple text file):

vi /home/user/test file

It tries to create a new file named "test".

I tried:

vi /home/user/ test\ file\

and it didn't work.
Old 05-05-2006, 05:18 PM   #4
Registered: Apr 2006
Location: Washington
Distribution: Suse, CentOS, Ubuntu
Posts: 124

Rep: Reputation: 15
vi /home/user/ test\ file

you had it looking for another character after file\
Old 05-05-2006, 06:15 PM   #5
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Easier--put the file name in quotes
Old 05-05-2006, 06:23 PM   #6
Registered: Sep 2005
Location: Old Blighty
Distribution: Slackware, NetBSD
Posts: 536

Rep: Reputation: 30
If you press Tab, the shell will complete the filename, and insert the spaces for you (and backslash escape them). At least, zsh does. Of course, you have to tediously press Tab twice in bash.

Thanks! What about if I want to edit a file with spaces in vi?
This is the same thing, since the command line is parsed by the shell.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Terminal question Optimistic Slackware 2 08-15-2004 12:39 PM
terminal question gonzalezjay Linux - General 7 10-16-2003 06:05 PM
Terminal question dsgdevil Linux - Software 6 08-26-2003 10:44 PM
Terminal question SnowSurfAir Linux - Software 2 08-17-2003 07:22 PM
terminal question DrOzz Linux - General 3 06-21-2003 11:15 PM

All times are GMT -5. The time now is 02:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration