LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Easy question to answer. Count commands in terminal (https://www.linuxquestions.org/questions/linux-newbie-8/easy-question-to-answer-count-commands-in-terminal-940749/)

Grassjelly 04-19-2012 06:02 PM

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

chrism01 04-19-2012 06:04 PM

What have you got so far; show us the code

Grassjelly 04-19-2012 06:27 PM

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

ls -l

chrism01 04-19-2012 06:59 PM

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 ;)

Tinkster 04-19-2012 07:08 PM

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

Grassjelly 04-19-2012 08:13 PM

@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.

grail 04-20-2012 01:27 AM

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 :)


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