Results 1 to 4 of 4
Could anyone please tell me why the ls command with * parameter not work. It works when there is no * in the name
[root@localhost bin]# ls -F 'firefox'
firefox*
...
- 01-11-2012 #1Just Joined!
- Join Date
- Oct 2011
- Posts
- 67
ls syntax issues ...
Could anyone please tell me why the ls command with * parameter not work. It works when there is no * in the name
[root@localhost bin]# ls -F 'firefox'
firefox*
[root@localhost bin]# ls -F '*fire*'
ls: cannot access *fire*: No such file or directory
[root@localhost bin]# ls -F 'fire*'
ls: cannot access fire*: No such file or directory
The first one works and shows that i have a firefox but when i search for it using '*fire*' or 'fire*' it doesnt work . Could anyone tell me why ?? I use this in find and it works ok .. is there a rule to using '*' parameter while searching ??Last edited by zedan85; 01-11-2012 at 03:21 AM.
- 01-11-2012 #2Just Joined!
- Join Date
- Nov 2008
- Posts
- 11
Hi.
What is the purpose of -F option is not perfectly clear for me.
But the rest of our issue is clear.
Some shells, for example tcsh and csh, expand the name with * into the list of corresponding file names from the current directory. The quotation marks prevent this, this making ls searching file with name *fire* or fire*, which are absent in your
directory, which ls tells you.
The find command can expand names correctly, so the command like
find -name "*fire*" -print
shows your file.
I do not know which shell you are using. I do not know whether all shells are working by this way.
But my answer should anyway give you the idea of what is happening in your case.
- 01-11-2012 #3
The * won't work with that -F option:
From the manpages:
Code:-F, --classify append indicator (one of */=>@|) to entrieslinux user # 503963
- 01-11-2012 #4Just Joined!
- Join Date
- Oct 2011
- Posts
- 67
I figured it out in case of ls you dont need the ' marks. you could go like ls *filename*. Pretty out of the place but it still works. Thanks .. Btw i am using BASH


Reply With Quote