LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 02-19-2010, 12:29 PM   #1
kickarzt
LQ Newbie
 
Registered: Feb 2010
Posts: 18

Rep: Reputation: 0
ls -l /bin/??


Why cant I get this command to execute?
ls -l /bin/?? | grep rwxr-xr-x | sort

Do I have to stand somewhere in the filessystem, or what?
I can execute the first command, but not the second (grep) if I do them one by one.

Please help!
 
Old 02-19-2010, 12:35 PM   #2
ericzqma
LQ Newbie
 
Registered: Jan 2010
Location: Hong Kong
Distribution: Fedora
Posts: 15
Blog Entries: 1

Rep: Reputation: 1
I can run this command in my system:
[zma@localhost tmp]$ ls -l /bin/?? | grep rwxr-xr-x | sort
-rwxr-xr-x 1 root root 110008 2010-01-12 22:35 /bin/mv
-rwxr-xr-x 1 root root 116688 2010-01-12 22:35 /bin/ls
-rwxr-xr-x 1 root root 118928 2010-01-12 22:35 /bin/cp
...

Have grep been installed in your system? You can try "whereis grep" to see whether you have it.

If it does not exist, you should install it first.

In fedora, it is:

#yum install grep
 
Old 02-19-2010, 12:36 PM   #3
fusion1275
Member
 
Registered: Jul 2007
Location: Portsmouth, Hants
Distribution: Linux Mint
Posts: 266

Rep: Reputation: 35
Worked fine for me as root and also as normal user

Quote:
root@Zeus-home:~# ls -l /bin/?? | grep rwxr-xr-x | sort
-rwxr-xr-x 1 root root 101232 2009-09-15 22:57 /bin/ps
-rwxr-xr-x 1 root root 105552 2009-10-06 12:06 /bin/cp
-rwxr-xr-x 1 root root 114032 2009-10-06 12:06 /bin/ls
-rwxr-xr-x 1 root root 218152 2009-04-29 02:50 /bin/ip
-rwxr-xr-x 1 root root 48840 2009-07-20 19:48 /bin/ed
-rwxr-xr-x 1 root root 55912 2009-10-06 12:06 /bin/ln
-rwxr-xr-x 1 root root 60120 2009-10-06 12:06 /bin/dd
-rwxr-xr-x 1 root root 64208 2009-10-06 12:06 /bin/rm
-rwxr-xr-x 1 root root 76568 2009-10-06 12:06 /bin/df
-rwxr-xr-x 1 root root 97352 2009-10-06 12:06 /bin/mv
root@Zeus-home:~# logout
fusion@Zeus-home:~$ ls -l /bin/?? | grep rwxr-xr-x | sort
-rwxr-xr-x 1 root root 101232 2009-09-15 22:57 /bin/ps
-rwxr-xr-x 1 root root 105552 2009-10-06 12:06 /bin/cp
-rwxr-xr-x 1 root root 114032 2009-10-06 12:06 /bin/ls
-rwxr-xr-x 1 root root 218152 2009-04-29 02:50 /bin/ip
-rwxr-xr-x 1 root root 48840 2009-07-20 19:48 /bin/ed
-rwxr-xr-x 1 root root 55912 2009-10-06 12:06 /bin/ln
-rwxr-xr-x 1 root root 60120 2009-10-06 12:06 /bin/dd
-rwxr-xr-x 1 root root 64208 2009-10-06 12:06 /bin/rm
-rwxr-xr-x 1 root root 76568 2009-10-06 12:06 /bin/df
-rwxr-xr-x 1 root root 97352 2009-10-06 12:06 /bin/mv
fusion@Zeus-home:~$
what version of Linux are you using?
What shell are you using?
What errors are you getting?

Rgds
 
Old 02-19-2010, 02:59 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
ditto---works here
 
Old 02-19-2010, 11:40 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by kickarzt View Post
I can execute the first command, but not the second (grep) if I do them one by one.
What happens when you run the grep command at a command line? It should wait for input. You can feed it multiple lines and terminate with Ctrl+D.
 
Old 02-23-2010, 08:22 AM   #6
kickarzt
LQ Newbie
 
Registered: Feb 2010
Posts: 18

Original Poster
Rep: Reputation: 0
cant get it right

Thanks for all answers!
I guess Im so newbe so I don`t understand what should happend.
I get an empty input line when grep is called, if I press ctrl+D, nothing happens.
I expect to get an output of what I want to grep, in this case files with rwxr-xr-x, but I don`t. I can see that files like this exist after I run the first command, so I dont get it.

My answer took a while, cause I wanted to try this again first, but no progress :-(

I anyone have time, please explain whats wrong, or how I use the grep command, if I missunderstood this..

I use Ubuntu and OS X. Grep is installed.
 
Old 02-23-2010, 08:52 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
First, does grep work normally in other situations? For example, look at a small text file (make one if necessary), and use grep to find a word, eg:
Code:
grep word filename
Second, if you run the grep command by itself with only a keyword, then I would not know what to expect. (grep needs a keyword and a file--or data stream--to read from)

Last edited by pixellany; 02-23-2010 at 08:54 AM.
 
Old 02-23-2010, 12:47 PM   #8
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,029

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
can you show us the output of
Code:
ls -l /bin/??
so that we know what the output grep should be working on would be.
 
  


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
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 09:33 AM
How to add paths to sbin, bin/bash, bin sh for users gopi.d Fedora 3 12-07-2007 01:47 AM
sudo /usr/bin/chroot /home/chroot /bin/su - xxx| /bin/su: user xxx does not exist saavik Linux - General 3 07-04-2007 11:30 AM
Installing .bin-files, leave the file in /usr/local/bin/ ? lagu2653 Linux - Software 1 11-08-2005 09:30 PM
Newbie needs help Installing j2sdk-1_4_2-nb_3_5_1-bin-linux.bin bendoku Linux - Newbie 5 10-11-2003 10:27 AM


All times are GMT -5. The time now is 11:12 AM.

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