LinuxQuestions.org
Visit Jeremy's Blog.
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 02-16-2012, 06:44 AM   #1
amar.sree
LQ Newbie
 
Registered: Feb 2012
Location: india
Distribution: Redhat
Posts: 18

Rep: Reputation: Disabled
hidden files


how to list hidden file only?

how to list 15 largest files/dir?
 
Old 02-16-2012, 06:49 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
You appear to just be dumping questions on to our site. They read as if they are homework or such like, and we are not here to do your work for you. You have not written proper posts, you have not said please / thank you for the help you have already received. Please don't continue to post like this, thanks.
 
Old 02-16-2012, 06:51 AM   #3
hallucinative
LQ Newbie
 
Registered: Feb 2012
Location: Western Australia
Distribution: Ubuntu Server
Posts: 18

Rep: Reputation: 5
Hidden files only I would use

Code:
ls -a | grep '^\.'
Not sure about the 15 largest files though..

Last edited by hallucinative; 02-16-2012 at 07:24 AM. Reason: Fixed the grep Regox expression
 
1 members found this post helpful.
Old 02-16-2012, 06:53 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Quote:
Originally Posted by hallucinative View Post
Hidden files only I would use

Code:
ls -a | grep ".*"
I wouldn't, as that doesn't work. ;-) That just greps all lines which have any number of any possible characters in them, including zero. here the "." is used as a regular expression character, not a literal period mark in the file name. And if it DID act as that, it would only match lines containing a period anywhere in them, so file.txt would also be matched.

Last edited by acid_kewpie; 02-16-2012 at 06:56 AM.
 
Old 02-16-2012, 06:54 AM   #5
amar.sree
LQ Newbie
 
Registered: Feb 2012
Location: india
Distribution: Redhat
Posts: 18

Original Poster
Rep: Reputation: Disabled
thanks dude......
 
Old 02-16-2012, 07:04 AM   #6
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 813

Rep: Reputation: 195Reputation: 195
ls -S would sort by file size including the hidden directories. Then (in the same command line) he has to pass the result to a command that allows him to filter only the last 15 lines.

So many other ways too ..

What people are telling amar is that he must try out BEFORE POSTING bald questions. This way the audience knows how exactly to help him learn and not mug up.

OK
 
Old 02-16-2012, 07:11 AM   #7
hallucinative
LQ Newbie
 
Registered: Feb 2012
Location: Western Australia
Distribution: Ubuntu Server
Posts: 18

Rep: Reputation: 5
Quote:
Originally Posted by AnanthaP View Post
ls -S would sort by file size including the hidden directories. Then (in the same command line) he has to pass the result to a command that allows him to filter only the last 15 lines.
This works for sorting files in reverse order of file size...then grabs the last 15 lines...
Code:
ls -rS | tail -n 15
 
Old 02-16-2012, 07:17 AM   #8
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 813

Rep: Reputation: 195Reputation: 195
I didn't want to spoon feed him.

As a one time noob, and me being a senior citizen and all that, I would feel happy if he really tried out on his own and posted his doublts.

OK
 
Old 02-16-2012, 07:19 AM   #9
hallucinative
LQ Newbie
 
Registered: Feb 2012
Location: Western Australia
Distribution: Ubuntu Server
Posts: 18

Rep: Reputation: 5
I'm using this forum as a way for me to learn.. at one stage or another I had to learn how to use a pipe.. and I can tell you it wasn't through official documentation XD
 
Old 02-16-2012, 07:22 AM   #10
hallucinative
LQ Newbie
 
Registered: Feb 2012
Location: Western Australia
Distribution: Ubuntu Server
Posts: 18

Rep: Reputation: 5
Quote:
Originally Posted by acid_kewpie View Post
I wouldn't, as that doesn't work. ;-)
Yeah I just tried it in a folder with no files XD..

Use this instead
Code:
ls -a | grep '^\.'
I learned something new XD

Cheat sheet for regular expressions (The ^\.)
http://www.robelle.com/smugbook/regexpr.html
 
  


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
How do I make find exclude hidden files (.files) Rotwang Linux - General 2 08-08-2011 04:58 AM
[SOLVED] Delete regular files (not hidden files) with find + rm in one line older than 15 Virtuose Linux - Newbie 1 01-08-2011 06:24 PM
[SOLVED] recursively cp all directories, files and hidden files WildDrake! Linux - Newbie 9 05-18-2010 05:39 PM
bash: mv hidden and not hidden files lupe Linux - General 4 06-22-2009 02:27 PM
home directory files gone, hidden files remain Grasshopper Linux - Security 12 04-10-2005 09:23 PM


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