Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-16-2010, 06:32 PM   #16
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 553

Rep: Reputation: 116Reputation: 116

Originally Posted by chrism01 View Post
chmod u+s (set suid) affects the user's 'x' permission char, not the file type char ie first char in ls -l
But it wouldn't work for special files - devices, sockets etc.
Old 04-19-2011, 04:55 AM   #17
LQ Newbie
Registered: Apr 2011
Posts: 1

Rep: Reputation: 1
All of this is nice but none of those commands counts hidden files/directories (starting with ".") so flag -a should be included in ls command:

ls -a1 | wc -l (for files, links and directories)


ls -la | grep ^- | wc -l <- for files
ls -la | grep ^d | wc -l <- for directories*
ls -la | grep ^l | wc -l <- for symbolic links

Note: Parent directory (..) and current directory are included in result(.) for directories so 2 should be subtracted from result in order do get proper data
1 members found this post helpful.
Old 09-21-2013, 07:33 AM   #18
Registered: Nov 2010
Distribution: RedHat
Posts: 97

Rep: Reputation: 2
Just try this one:

# ls -lhu

or only for dirs:
# ls -lahu */
Old 08-25-2015, 02:01 AM   #19
LQ Newbie
Registered: Jan 2013
Posts: 1

Rep: Reputation: Disabled
Originally Posted by nx5000 View Post
ls -l | grep ^- | wc -l
ls -l | grep ^d | wc -l
ls -l | grep ^l | wc -l
Tnx a lot.
simple and very useful.


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
How to find grand total size of all files in a directory fakhrul Red Hat 4 04-17-2010 01:28 AM
find the total number of pseudo terminals of all logins RajRed Linux - General 5 04-18-2006 05:30 AM
Find 100 largest files in folder tree tyreth Linux - General 2 02-07-2006 09:18 AM
count total number of lines in several files xushi Programming 5 11-12-2005 05:42 PM
Command to list total number of files. WillieB_72 Linux - General 3 01-29-2003 10:25 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:14 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration