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 04-19-2012, 06:02 PM   #1
Grassjelly
LQ Newbie
 
Registered: Apr 2012
Posts: 3

Rep: Reputation: Disabled
Thumbs up Easy question to answer. Count commands in terminal


I am completely new to Linux and I am trying to add up information in a directory with the terminal.

in my /dev I am trying to add up characters, blocks, links, directories, and standard files

Please help! thanks you
 
Old 04-19-2012, 06:04 PM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,287

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
What have you got so far; show us the code
 
Old 04-19-2012, 06:27 PM   #3
Grassjelly
LQ Newbie
 
Registered: Apr 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
well I don't know where to start, but so far I have listed the files in the dir with:

ls -l
 
Old 04-19-2012, 06:59 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,287

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
You'll want these links:
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
http://linux.die.net/man/

Note that you title is wrong; you're counting file entries, not cmds

However, here's a hint
Code:
ls -l |grep ^d
list only lines beginning with 'd'.
Check the wc cmd http://linux.die.net/man/1/wc
 
1 members found this post helpful.
Old 04-19-2012, 07:08 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,983
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
And since there's lot of ways of skinning a cat ... have a look
at what you could achieve with
find & stat instead of ls
 
Old 04-19-2012, 08:13 PM   #6
Grassjelly
LQ Newbie
 
Registered: Apr 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thumbs up

@chrism01

Thanks that helped out a lot! I was looking for the "command" that would tell me how to count the files, but you got the idea. I figured it out thanks to you. Linux is a mysterious beast.
 
Old 04-20-2012, 01:27 AM   #7
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,561

Rep: Reputation: 1939Reputation: 1939Reputation: 1939Reputation: 1939Reputation: 1939Reputation: 1939Reputation: 1939Reputation: 1939Reputation: 1939Reputation: 1939Reputation: 1939
Remember to mark question as SOLVED once you have a solution. Also nice if you share the solution so when people search they can learn from you too
 
  


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
this is a noobish easy to answer question lowpingnoob Linux - Newbie 6 06-13-2005 03:10 PM
Quick Question....Easy Answer iammike Linux - Software 2 08-22-2004 01:09 PM
Easy question to answer! Please help alpineidyll Linux - Software 7 11-16-2003 02:42 PM
iptables easy to answer question BajaNick Linux - Security 4 09-19-2003 08:22 PM
Easy question to answer BajaNick Programming 3 08-03-2003 05:49 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration