LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 11:29 AM   #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, 11:35 AM   #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, 11:36 AM   #3
fusion1275
Member
 
Registered: Jul 2007
Location: Knaphill, Surrey
Distribution: Linux Mint
Posts: 310

Rep: Reputation: 36
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, 01:59 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

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

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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, 07: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 Iīm 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 donīt 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, 07:52 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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 07:54 AM.
 
Old 02-23-2010, 11:47 AM   #8
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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



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 08:33 AM
How to add paths to sbin, bin/bash, bin sh for users gopi.d Fedora 3 12-07-2007 12: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 10:30 AM
Installing .bin-files, leave the file in /usr/local/bin/ ? lagu2653 Linux - Software 1 11-08-2005 08:30 PM
Newbie needs help Installing j2sdk-1_4_2-nb_3_5_1-bin-linux.bin bendoku Linux - Newbie 5 10-11-2003 09:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:28 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
Open Source Consulting | Domain Registration