PDA

View Full Version : ls command



DazedNConfuzed
01-15-2008, 08:12 PM
I'm being asked to show the contents of a specific directory with the exclusion of one particular file.

How do I do this?

Digiital
01-15-2008, 08:23 PM
ls !(<filename you dont want listed>)

example:

ls -l !(readme.txt)

DazedNConfuzed
01-15-2008, 08:27 PM
hey, thanks for the reply...I figured it out.

I keyed in: ls *.copy

I had 3 files in the directory with .copy in them and 1 file called something else. So I used *.copy to display only .copy entries.


I suppose that works.

DazedNConfuzed
01-15-2008, 08:37 PM
Now i'm being asked to display contents in the current directory with either files bearing an uppercase G and/or lowercase g

i'm stumped. lol and i know this is a basic command structure

cdnLilWolf
01-16-2008, 05:24 AM
I'm being asked to show the contents of a specific directory with the exclusion of one particular file.

How do I do this?

Use grep with the command. For example....

ls -l | grep "g"

DazedNConfuzed
01-16-2008, 06:24 AM
^ yes, thank you!

Digiital
01-16-2008, 08:44 AM
Hope your not asking us to do your homework.

cdnLilWolf
01-16-2008, 03:29 PM
Hope your not asking us to do your homework.

If that is the case, then they will fail in the real world. In the meantime I'll write it off as a case of "can't see the forest 'cause of the trees". ;)

DazedNConfuzed
01-16-2008, 08:09 PM
Hope your not asking us to do your homework.

I was trying command after command. With all sorts of * [] ! ?.

Nothing was working.

I managed to figure the first command shortly after I posted.

cdnLilWolf
01-16-2008, 08:29 PM
I was trying command after command. With all sorts of * [] ! ?.
Nothing was working.
I managed to figure the first command shortly after I posted.

Don't sweat it. I still trying to wrap my mind around Python and scripting languages in general after using something as strongly typed as Object Pascal within Borland's Delphi.