LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 05-05-2006, 05:01 PM   #1
sunmicroman
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, 05:06 PM   #2
puntjuh
Member
 
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, 05:43 PM   #3
sunmicroman
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, 06:18 PM   #4
hockeyman_102
Member
 
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, 07:15 PM   #5
pixellany
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, 07:23 PM   #6
ioerror
Member
 
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.

Quote:
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.
 
  


Reply


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 01:39 PM
terminal question gonzalezjay Linux - General 7 10-16-2003 07:05 PM
Terminal question dsgdevil Linux - Software 6 08-26-2003 11:44 PM
Terminal question SnowSurfAir Linux - Software 2 08-17-2003 08:22 PM
terminal question DrOzz Linux - General 3 06-22-2003 12:15 AM


All times are GMT -5. The time now is 07:59 PM.

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