Results 1 to 9 of 9
Hi everyone!
I am trying to learn how to open/list down files of a partition in the terminal but I seem to can't get it right. . Like it says ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-23-2010 #1
Terminal Questions?
Hi everyone!

I am trying to learn how to open/list down files of a partition in the terminal but I seem to can't get it right.
. Like it says "no such file" but ls command says otherwise.
Here's what I was trying to do. I would really appreciate it if somebody can tell me what am I doing wrong and how I should be doing it instead. Thank you in advance!
Code:[jun@localhost ~]$ su - Password: [root@localhost ~]# cd / [root@localhost /]# cd media [root@localhost media]# ls Mint 7 Storage Bin (A) Storage Bin (B) Ubuntu 9.10 XP Windows :( [root@localhost media]# cd Mint 7 -bash: cd: Mint: No such file or directory [root@localhost media]# cd Storage Bin (B) -bash: syntax error near unexpected token `(' [root@localhost media]# cd Ubuntu 9.10 -bash: cd: Ubuntu: No such file or directory [root@localhost media]#nujinini
Linux User #489667
- 02-23-2010 #2Linux Guru
- Join Date
- Oct 2007
- Location
- Tucson AZ
- Posts
- 2,514
The problem is spaces and you need quotes, not sure if double or single, I always use double:
[root@localhost media]# mkdir "Mint 7"
[root@localhost media]# ls
cdrom/ dvd/ Mint 7/
[root@localhost media]# cd "Mint 7"
[root@localhost Mint 7]#
- 02-23-2010 #3
Thanks a lot yancek!

Code:[jun@localhost ~]$ su - Password: [root@localhost ~]# cd / [root@localhost /]# cd media [root@localhost media]# ls Mint 7 Storage Bin (A) Storage Bin (B) Ubuntu 9.10 XP Windows :( [root@localhost media]# cd "Mint 7" [root@localhost Mint 7]# ls bin dev initrd.img media proc selinux tmp vmlinuz boot etc lib mnt root srv usr cdrom home lost+found opt sbin sys var [root@localhost Mint 7]# cd media [root@localhost media]# cd "Storage Bin (B)" [root@localhost Storage Bin (B)]# ls [root@localhost Storage Bin (B)]# ls -l total 0
nujinini
Linux User #489667
- 02-23-2010 #4
You may also use a backslash. Here is an example for you.
Notice the spaces?Code:ls /media/music/MP3/ ZZ Top - Beer Drinkers and Hell Raisers.mp3 ZZ Top - Gimme All Your Lovin'.mp3 ZZ Top - Just Got Paid.mp3 ZZTop -Nation Wide.MP3
Now use the dir command.
So then, back to your problem, you could also use:Code:dir /media/music/MP3/ ZZ\ Top\ -\ Beer\ Drinkers\ and\ Hell\ Raisers.mp3 ZZ\ Top\ -\ Gimme\ All\ Your\ Lovin'.mp3 ZZ\ Top\ -\ Just\ Got\ Paid.mp3 ZZTop\ -Nation\ Wide.MP3
FYI, use the Tab button for autocompletion.Code:cd Mint\ 7 cd Storage\ Bin
For example
It should autocomplete the Mint\ 7 for you.Code:ls Min (Press Tab button once)
I do not respond to private messages asking for Linux help, Please keep it on the forums only.
All new users please read this.** Forum FAQS. ** Adopt an unanswered post.
I'd rather be lost at the lake than found at home.
- 02-23-2010 #5
Just to fill in the blanks a little, no pun intended, the backslash method as Miktbob recommended is called escaping.
Normally, the shell interprets spaces as a separator between filenames or commands. The escape character tells the shell to interpret the next character literally.
- 02-23-2010 #6I do not respond to private messages asking for Linux help, Please keep it on the forums only.
All new users please read this.** Forum FAQS. ** Adopt an unanswered post.
I'd rather be lost at the lake than found at home.
- 02-23-2010 #7Thank you Mike Tbob!You may also use a backslash. Here is an example for you.
Notice the spaces?Code:ls /media/music/MP3/ ZZ Top - Beer Drinkers and Hell Raisers.mp3 ZZ Top - Gimme All Your Lovin'.mp3 ZZ Top - Just Got Paid.mp3 ZZTop -Nation Wide.MP3
Now use the dir command.
So then, back to your problem, you could also use:Code:dir /media/music/MP3/ ZZ\ Top\ -\ Beer\ Drinkers\ and\ Hell\ Raisers.mp3 ZZ\ Top\ -\ Gimme\ All\ Your\ Lovin'.mp3 ZZ\ Top\ -\ Just\ Got\ Paid.mp3 ZZTop\ -Nation\ Wide.MP3
Code:cd Mint\ 7 cd Storage\ Bin

How should I end the syntax for cd /media/Storage\ Bin\ (A) please? I tried "/" & "\". No diceCode:[jun@localhost ~]$ cd /media/Mint\ 7 [jun@localhost Mint 7]$ cd /media/Storage\ Bin\ (A) bash: syntax error near unexpected token `(' [jun@localhost Mint 7]$ cd /media/Storage\ Bin\ (A)/ bash: syntax error near unexpected token `(' [jun@localhost Mint 7]$ cd /media/Storage\ Bin\ (A)\ bash: syntax error near unexpected token `(' [jun@localhost Mint 7]$
This time I tried the Tab button and it completed the syntax. Only If you may notice, I have "Storage Bin (A) & Storage Bin (B)...So I manually completed by putting "B".....but the same question on what character should I end it with as above?FYI, use the Tab button for autocompletion.
For example
It should autocomplete the Mint\ 7 for you.Code:ls Min (Press Tab button once)
Code:[jun@localhost ~]$ cd /media/Storage\ Bin\ \(B) bash: syntax error near unexpected token `)' [jun@localhost ~]$
Last edited by nujinini; 02-23-2010 at 07:18 AM.
nujinini
Linux User #489667
- 02-23-2010 #8
- 02-23-2010 #9
I have another partition that I fondly call XP Windows (:
Just to make sure that those who would use the partition better be careful and scan when downloading.
Back to my question....the output is different. I noticed that I have to place a "\" before the first character and also after each special character and end with a "/". Then I can get what I want. I hope I got it right
I guess this answers my question Mike TbobCode:[jun@localhost ~]$ cd /media/XP\ Windows\ \:\(/ [jun@localhost XP Windows :(]$
, I hope....
Thanks!nujinini
Linux User #489667


Reply With Quote

