LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   hidden files (https://www.linuxquestions.org/questions/linux-newbie-8/hidden-files-929679/)

amar.sree 02-16-2012 05:44 AM

hidden files
 
how to list hidden file only?

how to list 15 largest files/dir?

acid_kewpie 02-16-2012 05:49 AM

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.

hallucinative 02-16-2012 05:51 AM

Hidden files only I would use

Code:

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

acid_kewpie 02-16-2012 05:53 AM

Quote:

Originally Posted by hallucinative (Post 4603946)
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.

amar.sree 02-16-2012 05:54 AM

thanks dude......

AnanthaP 02-16-2012 06:04 AM

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

hallucinative 02-16-2012 06:11 AM

Quote:

Originally Posted by AnanthaP (Post 4603963)
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

AnanthaP 02-16-2012 06:17 AM

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

hallucinative 02-16-2012 06:19 AM

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

hallucinative 02-16-2012 06:22 AM

Quote:

Originally Posted by acid_kewpie (Post 4603949)
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


All times are GMT -5. The time now is 02:08 PM.