Skip to main content

Using 'ls' command as a replacement of 'find'

Advantage over find - Actually not probably in terms of speed, but... only point of this is that it's an observation, but... you can do like 'search only in' */*/*Programs* , /*/*Programs*/* , this may compensate the extra time took by using two commands


1. To search in current folder only (1 level... only this folder, no subfolder)
    Type... ls | grep Search_Term
2. To search in current folder only (till level 2... this folder + subfolder)
    Type... ls * | grep Search_Term

#ls and ls * are NOT same!

3. To search in current folder only (till level 3... this folder + subfolder + subfolder)
    Type... ls */* | grep Search_Term
4. To search in current folder only (till level 4... this folder + subfolder + subfolder + subfolder)
    Type... ls */*/* | grep Search_Term
... and so on...

FORMULA - To search till 'n' level (considering current folder as 1)... go till (n-1) stars

If wanting to search whole disk... better type stars, like this... ls * ** *** **** ***** ****** ******* ******** ********
Then put slashes between them from end to start... or copy this : ls * */* */*/* */*/*/* */*/*/*/* */*/*/*/*/* */*/*/*/*/*/* */*/*/*/*/*/* */*/*/*/*/*/*/*

Comments

  1. How boring myself 😂

    Lekin ha, ye bhi achha idea tha, us time mereko '-max_depth' flag nhi pta tha, to bahut time leta bemtlb .git etc directories deep search krne lgta tha wo :'D

    ReplyDelete
    Replies
    1. Hah, you did not know many flags 2021 adi 😂

      Delete

Post a Comment

You are free to leave any kind of suggestion, or improvement. It doesn't require you to sign in either.

Popular posts from this blog

LudO - The Game

/* Programmer - Aditya Gupta (Techy15) Language - C++ Program - LudO - The Game */ /* PLANS- Add functionality for name of player */ //IMP NOTE - See all notes, written in this form "//NOTE..." //NOTE- Mark 'R','G','B','Y' for gotis, ignore doubling for now //NOTE- Settings will have options: change default game play order(ie RBYG), change/give names to each colour //NOTE- Add code in case of attacks //NOTE- Add stops, and ways to show them distinct from others {may require graphics.h} #include<iostream> /* #include<fstream>    To be used in case save & resume to be used*/ #include<cstdio> #include<cstdlib> using namespace std; //Changes on 16th Oct //Show gotis as R1, R2... and ask user to enter string R1 or whatever // // Place within appropriate block ...     short diethrow(){     int fl=1; //holds 0 if decnum is 0     while(fl==0) { char *temp;     ...

More_Inferences_in_C++(1Aug'19-16thOct'19)

Programmer/Tester- Aditya Gupta (aka Techy3.5 :-) I used g++ to compile these on linux 1. Type casting of floating point numeral to integer (either automatic or by type casting)- Conversion of floating point to integer is by taking the GIF (Greatest Integer Funtion) and NOT ROUNDING OFF Greatest Integer Function(Maths,12th) it gives the integer part when the original number is written as integer+fractional part (where fractional part is less than 1 but positive) 2. NEsted MultiLine Comment [actually wont work as expected?!] if you do this in C++.... /*  blah /*blah blah blah*/ blah*/ the last blah will be visible to the compiler!!! (Inference- Multiline-Comment ends whenever */ is encountered, no matter where!!)NEsted MultiLine Comment 3. Size of various types (of C++) on 'Linux' Mint - (and same as in later versions of windows, and most PCs nowadays) char - 1 int - 4  (and: short - 2, unsigned long - 8) long long - 8 float - 4 double - 8 (and: l...