LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-13-2008, 07:29 AM   #1
jianelisj
LQ Newbie
 
Registered: Mar 2008
Posts: 18

Rep: Reputation: 0
Show only executable files of a system folder


i would like some help the following problem:
show only executable files of a system folder.

My idea is: ls -h /.

but is does not work. Why?

I would appreciate any help.
 
Old 03-13-2008, 07:52 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,542
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,
Quote:
Originally Posted by jianelisj View Post
i would like some help the following problem:
show only executable files of a system folder.

My idea is: ls -h /.

but is does not work. Why?

I would appreciate any help.
You should 'man ls' to get a better understanding of the command.
The 'ls -h /' says to list the content of the '/' and display in a human readable format. Your system probably displayed;
Code:
~#ls -h /
arc1/  bin/   etc/   lost+found/  opt/   sbin/  sys/  var/
arc2/  boot/  home/  media/       proc/  site/  tmp/
arc3/  dev/   lib/   mnt/         root/  srv/   usr/
Or something similar. If you want to display the content of '/' with a long listing then;

Code:
 ls -lh
~#ls -lh /
total 88K
drwxr-xr-x  5 root root 4.0K 2008-03-08 21:16 arc1/
drwxr-xr-x  3 root root 4.0K 2007-08-04 11:15 arc2/
drwxr-xr-x  3 root root 4.0K 2007-08-04 11:20 arc3/
drwxr-xr-x  2 root root 4.0K 2007-04-29 23:35 bin/
drwxr-xr-x  3 root root 4.0K 2007-09-17 04:11 boot/
drwxr-xr-x 19 root root  14K 2007-12-01 09:59 dev/
drwxr-xr-x 61 root root 4.0K 2007-12-28 14:16 etc/
drwxr-xr-x  6 root root 4.0K 2007-12-13 18:21 home/
drwxr-xr-x  5 root root 4.0K 2007-08-04 11:42 lib/
drwx------  2 root root  16K 2007-08-04 11:01 lost+found/
drwxr-xr-x 16 root root 4.0K 2007-09-17 04:06 media/
drwxr-xr-x 16 root root 4.0K 2007-08-05 17:22 mnt/
drwxr-xr-x  2 root root 4.0K 2007-06-10 01:23 opt/
dr-xr-xr-x 94 root root    0 2007-11-06 04:31 proc/
drwx--x--- 10 root root 4.0K 2008-03-13 00:43 root/
drwxr-xr-x  2 root root 4.0K 2007-05-19 00:44 sbin/
drwxr-xr-x  2 root root 4.0K 2007-08-04 11:26 site/
drwxr-xr-x  2 root root 4.0K 2007-08-04 11:41 srv/
drwxr-xr-x 12 root root    0 2007-11-06 04:31 sys/
drwxrwxrwt  5 root root 4.0K 2008-03-12 17:46 tmp/
drwxr-xr-x 18 root root 4.0K 2007-02-21 12:31 usr/
drwxr-xr-x 17 root root 4.0K 2007-05-27 00:13 var/
If you want to see the content of a specific directory then;
Code:
~#ls -hl /boot
total 17M
lrwxrwxrwx 1 root root   37 2007-08-04 11:34 README.initrd -> /usr/doc/mkinitrd-1.1.2/README.initrd
lrwxrwxrwx 1 root root   32 2007-08-04 11:52 System.map -> System.map-huge-smp-2.6.21.5-smp
-rw-r--r-- 1 root root 778K 2007-06-19 15:18 System.map-generic-2.6.21.5
-rw-r--r-- 1 root root 795K 2007-06-19 14:53 System.map-generic-smp-2.6.21.5-smp
-rw-r--r-- 1 root root 1.2M 2007-06-19 15:23 System.map-huge-2.6.21.5
-rw-r--r-- 1 root root 1.2M 2007-06-19 14:58 System.map-huge-smp-2.6.21.5-smp
-rw-r--r-- 1 root root  512 2007-08-04 11:54 boot.0300
-rw-r--r-- 1 root root  512 2007-09-15 22:43 boot.0301
-rw-r--r-- 1 root root  512 2007-09-17 03:59 boot.0800
-rw-r--r-- 1 root root  168 2007-08-04 11:54 boot_message.txt
lrwxrwxrwx 1 root root   28 2007-08-04 11:52 config -> config-huge-smp-2.6.21.5-smp
-rw-r--r-- 1 root root  72K 2007-06-19 15:18 config-generic-2.6.21.5
-rw-r--r-- 1 root root  72K 2007-06-19 14:53 config-generic-smp-2.6.21.5-smp
-rw-r--r-- 1 root root  71K 2007-06-19 15:23 config-huge-2.6.21.5
-rw-r--r-- 1 root root  71K 2007-06-19 14:58 config-huge-smp-2.6.21.5-smp
-rw-r--r-- 1 root root 5.0K 2007-06-10 01:09 diag1.img
drwxr-xr-x 9 root root 4.0K 2007-09-17 04:01 initrd-tree/
-rw-r--r-- 1 root root 459K 2007-09-17 04:01 initrd.gz
-rw------- 1 root root 133K 2007-09-17 04:11 map
lrwxrwxrwx 1 root root   29 2007-08-04 11:52 vmlinuz -> vmlinuz-huge-smp-2.6.21.5-smp
-rw-r--r-- 1 root root 1.9M 2007-06-19 15:18 vmlinuz-generic-2.6.21.5
-rw-r--r-- 1 root root 2.0M 2007-06-19 14:53 vmlinuz-generic-smp-2.6.21.5-smp
-rw-r--r-- 1 root root 4.0M 2007-06-19 15:23 vmlinuz-huge-2.6.21.5
-rw-r--r-- 1 root root 4.3M 2007-06-19 14:58 vmlinuz-huge-smp-2.6.21.5-smp
You can wild card to get specific outputs within your list. You should 'man ls'.

'Learning the shell' is another good reference.

This link and others are available from 'Slackware-Links'
 
Old 03-17-2008, 01:24 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by jianelisj View Post
i would like some help the following problem:
show only executable files of a system folder.

My idea is: ls -h /.

but is does not work. Why?

I would appreciate any help.
What does the man-page say about -h? Does it
relate to executables?


Do your own homework.
 
Old 03-17-2008, 01:37 PM   #4
iamwilliam
Member
 
Registered: Apr 2006
Location: Nairobi
Distribution: CentOS
Posts: 78

Rep: Reputation: 21
should go something like
Quote:
find . -perm /u=x,g=x,o=x
man find for more
 
2 members found this post helpful.
Old 03-19-2008, 10:29 AM   #5
sentient6
LQ Newbie
 
Registered: Mar 2008
Location: patrai
Distribution: ubuntu
Posts: 4

Rep: Reputation: 0
It's not that difficult if you try to do "man ls" and find for the option that matches your creteria...


edit: greek out

jianelis r e a d t h e m a n u a l

Last edited by sentient6; 03-19-2008 at 01:52 PM.
 
Old 01-07-2012, 04:18 AM   #6
ashokJ
LQ Newbie
 
Registered: Jan 2012
Posts: 1

Rep: Reputation: Disabled
Lightbulb list only executables using ls Command

ls -F | grep '*'

or

ls -la | grep [w-]'x'[r-]
 
1 members found this post helpful.
Old 08-08-2013, 09:47 AM   #7
wirelessben
LQ Newbie
 
Registered: Jul 2008
Location: Columbia, SC
Distribution: Ubuntu, Debian, DSL
Posts: 4

Rep: Reputation: 1
Linux Friendliness Score: 0

iamwilliam nailed it. His solution is not in the man page or the info pages, but it is here. This is the reason for this forum's existence: better documentation than the man pages.

onebuck didn't answer the question. Tinkster and sentient6 went further and admonished this new user for merely being inexperienced. Apparently they read every man page available (even though they can be horrible pieces of user documentation*) before ever asking a question, and thus feel entitled to pass judgment.

This may be feeding the trolls, but I couldn't let this post go unchallenged, as if this general attitude towards newbies is the standard. Per xkcd, "someone is wrong on the internet".

*Try "man history" if you doubt this.
 
1 members found this post helpful.
Old 08-08-2013, 10:26 AM   #8
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,816

Rep: Reputation: 1346Reputation: 1346Reputation: 1346Reputation: 1346Reputation: 1346Reputation: 1346Reputation: 1346Reputation: 1346Reputation: 1346Reputation: 1346
You just revived a necro thread that had its last comment a year and a half ago, giving a proposed solution to a question 5 years ago.
 
  


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
samba shares show 0 files in every folder??? alabamaman Linux - Software 10 08-29-2007 01:50 PM
To copy files from a CD to a folder on your system Gins Linux - General 20 10-30-2006 01:53 PM
.htaccess show index files from a folder spank Linux - General 1 05-31-2006 04:29 PM
samba does not show folder contents Goma_2 Linux - Networking 0 12-10-2003 05:54 AM
Converting perl files to executable mac files mrozkan Programming 0 04-16-2002 10:56 AM


All times are GMT -5. The time now is 12:59 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration