LinuxQuestions.org
Review your favorite Linux distribution.
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 01-09-2009, 09:01 AM   #1
jonhanna
Member
 
Registered: Dec 2008
Posts: 31

Rep: Reputation: 15
question on functions in the directory


I apologize for all of the questions this week guys, My teacher has thrown some stuff at me that I am not used to since most of my work had been book work and I have just recently installed Linux on my pc, but anyways here goes:
What function would I use that lists the number of ordinary files, directories, block, special files, character special files, FIFO's and symbolic links in the working directory? I need to do this in two ways. How could I do this by using the first letter of the output of ls -l to determine a file's type? The second way is using the file type condition tests of the [[expression]] syntax to determine a file's type.
Once again I apologize for asking so many question this week and anything would help out, thanks guys.
 
Old 01-09-2009, 09:17 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
jonhanna;

You are a model citizen with respect to HOW to ask homework questions. But---you will still get some flak if it looks like you are just posting the latest assignment without having done any work. The questions most likely to be answered are of this form:
"I want to mow my lawn. I have tried scissors, hedge clippers, and the old push-mower. These all work, but I am looking for something faster. I have done a Google search on power mowers and I am unclear on the pro and cons of 2-stroke vs 4-stroke engines."

Your most recent questions are well-covered in the references you have been given in other threads. Please read and come back with specific questions.

Two hints:

Using first letter: Feed the output of ls to "grep", then to "wc"

2nd method: It looks like you want "test" (AKA "[") or "file" Look these up in your references or the man pages.
 
Old 01-09-2009, 09:29 AM   #3
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
If you have linux installed, you can type:
man command
Where command is the name of a command and get the full manual of that command.
Try this one:
man ls
If you read it, you should discover how to determine a file type from the first column of output
You can also try this one:
man man
 
Old 01-09-2009, 10:01 AM   #4
jonhanna
Member
 
Registered: Dec 2008
Posts: 31

Original Poster
Rep: Reputation: 15
Okay I appreciate the help guys and with my next questions I will explain what I have done to try and find out the answers, Thank you very much
 
  


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
Crawling a directory and executing Python functions. Travis86 Programming 2 07-06-2005 02:06 AM
debian installation failed: debootstrap/functions no such file or directory lixy Linux - General 1 01-25-2005 06:55 PM
basic directory functions ignus Linux - Newbie 2 08-13-2004 12:36 PM
how i can list directory by using read() & write() kernll functions ashamry Programming 2 05-10-2004 02:44 PM
question on pointers to functions h/w Programming 3 10-06-2003 05:51 PM

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

All times are GMT -5. The time now is 10:24 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