How can i display the files only?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can i display the files only?
# 1  
Old 04-10-2008
How can i display the files only?

Hi!

How can i display only the ordinary files of a current directory? I don't want to show any directory or hidden file information.

Kindly share your thought.

Thanks in advance for your reply.

Regards.
# 2  
Old 04-10-2008
CPU & Memory use find command for finding files.

Hi,

Use find command to display files only in the current directory.
First cd to that directory and then execute the following command
Usage :

find * -type f -print -o -type d -prune 2>/dev/null

If there are any sub-directories then they are all excluded.

***********************************************

If the sub-directories needs to be included the use the following

find * -type f -print 2>/dev/null

Hope this satisfies the requirement.

Let me know if you need any further help.....
# 3  
Old 04-10-2008
Code:
ls -lA | awk '$NF !~ /^\./ && /^-/{print $NF}'

# 4  
Old 04-10-2008
Thanks a lot. It is working.....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to display only line that contain in 2 files

Dear all, I have 2 file, as bellow. what I want is to display only number that show in both 2 files, that I marked blue color. first_file.txt : 510289880773910 510289880773965 510289880774004 510289880774036 510289880774067 510289880774080 510289880774085 second_file.txt: 510289880774639... (3 Replies)
Discussion started by: budi.mulya
3 Replies

2. UNIX for Advanced & Expert Users

How to display the files on screen

I connect via vnc to a linux computer. after a logout, I cannot see the files on the screen (although i can see the screensaver). I can open a terminal and see the files etc. How can i see the files on the screen again? (5 Replies)
Discussion started by: FelipeAd
5 Replies

3. Homework & Coursework Questions

display certain files ending

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: how to display a listing of all the files ending in txt using one command. 2. Relevant commands, code,... (4 Replies)
Discussion started by: austing5
4 Replies

4. UNIX for Dummies Questions & Answers

write a program in c in unix that display the files(includ sub-direc and files within) in a sorted

the sorting is based on name of file, file size modification time stamps o f file it should dislay the output in the following format "." and ".." enteries should be ignored please give some idea how to do it (1 Reply)
Discussion started by: pappu kumar jha
1 Replies

5. UNIX for Dummies Questions & Answers

Find files and display only directory list containing those files

I have a directory (and many sub dirs beneath) on AIX system, containing thousands of file. I'm looking to get a list of all directory containing "*.pdf" file. I know basic syntax of find command, but it gives me list of all pdf files, which numbers in thousands. All I need to know is, which... (4 Replies)
Discussion started by: r7p
4 Replies

6. UNIX for Dummies Questions & Answers

display files name and it's content

hello, i have a question and i'll be appreciated if you can help me with this. i have i folder let's say "users" in this folder there are files (file1, file2, file2, etc) and in each file there is a number (lets say 4 in file1) i want to display some thing like bellow file1 4... (6 Replies)
Discussion started by: dndoon
6 Replies

7. Shell Programming and Scripting

how to display only hidden files

how can i display only and only hidden file in the current directory. (7 Replies)
Discussion started by: useless79
7 Replies

8. UNIX for Dummies Questions & Answers

display large files

I'm looking to display the largest files in a file system without descending into subdirectories. The / file system is 65% full and I'm looking to display only the files in / without taking into consideration other filesystem/directories. I can execute this command du -sk ./* |sort -nr... (2 Replies)
Discussion started by: Steelysteel
2 Replies

9. Shell Programming and Scripting

Display the count of files

I am new to shell programming. Can anyone help me out with anyone of these? Display a count of the number of regular files, the number of symbolic links, the number of sub-directories, the number of block-special files, and the number of character-special files in the directory. I don't... (4 Replies)
Discussion started by: wayne1411
4 Replies

10. Solaris

ls does not display existing files

Hi, I have a pecular problem that I am experiencing. I have a few directories that seems to be missing, however, I can vi the files within them and I can also execute them (script files). For missing, I mean when I issue the "ls" command I don't see anything. Any help will be greatly... (1 Reply)
Discussion started by: copperUser
1 Replies
Login or Register to Ask a Question