I need to display all the files with .c (C program files) in the terminal and having problems to do so. My ideas were using find and grep and maybe gcc But none of my attempts worked. I am working on Linux. I don't know the file names. I just want to list all the files. I tried the following: ls *.c find . -type f *.c
44797
I want to search for all .conf files in /etc/. I tried grep -r *.conf /etc, but the result isn't right. What am I doing wrong?
84085
I'm making a C program where I need to get the directory that the program is started from.  This program is written for UNIX computers. I've been looking at opendir() and telldir(), but telldir() returns a off_t (long int), so it really doesn't help me.   How can I get the current path in a string (char array)?
22339
I'm looking for a way to list all files in a directory that contain the full set of keywords I'm seeking, anywhere in the file.  So, the keywords need not to appear on the same line.  One way to do this would be:  grep -l one $(grep -l two $(grep -l three *))   Three keywords is just an example, it could just as well be two, or four, and so on.  A second way I can think of is:  grep -l one * | xargs grep -l two | xargs grep -l three   A third method, that appeared in , would be:  find . -type f \   -exec grep -q one {} \; -a \   -exec grep -q two {} \; -a \   -exec grep -q three {} \; -a -print   But that's definitely not the direction I'm going here. I want something that requires less typing, and possibly just one call to grep, awk, perl or similar.  For example, I like how , like:  awk '/one/ &amp;&amp; /two/ &amp;&amp; /three/' *   Or, print just the file names:  awk '/one/ &amp;&amp; /two/ &amp;&amp; /three/ { print FILENAME ; nextfile }' *   But I want to find files where the keywords may be anywhere in the file, not necessarily on the same line.    Preferred solutions would be gzip friendly, for example grep has the zgrep variant that works on compressed files. Why I mention this, is that some solutions may not work well given this constraint. For example, in the awk example of printing matching files, you can't just do:  zcat * | awk '/pattern/ {print FILENAME; nextfile}'   You need to significantly change the command, to something like:  for f in *; do zcat $f | awk -v F=$f '/pattern/ { print F; nextfile }'; done   So, because of the constraint, you need to call awk many times, even though you could do it only once with uncompressed files. And certainly, it would be nicer to just do zawk '/pattern/ {print FILENAME; nextfile}' * and get the same effect, so I would prefer solutions that allow this.
85009
I have the following code that I run on my Terminal.  LC_ALL=C &amp;&amp; grep -F -f  genename2.txt hg38.hgnc.bed &gt; hg38.hgnc.goi.bed   This doesn't give me the common lines between the two files. What am I missing there?
10414
How can I list all the printable ASCII characters in the terminal?
46153
I want to find all lines in several files that match one of two patterns. I tried to find the patterns I'm looking for by typing   grep (foo|bar) *.txt   but the shell interprets the | as a pipe and complains when bar isn't an executable.  How can I grep for multiple patterns in the same set of files?
124031
I want to search for all files with the .sql extension in folders and sub-folders (recursive).  How can I do this?
35593
Which is more efficient for finding which files in an entire filesystem contain a string: recursive grep or find with grep in an exec statement?  I assume find would be more efficient because you can at least do some filtering if you know the file extension or a regex that matches the file name, but when you only know -type f which is better? GNU grep 2.6.3; find (GNU findutils) 4.4.2  Example:  grep -r -i 'the brown dog' /  find / -type f -exec grep -i 'the brown dog' {} \;
111273
Sometimes, I need to check only the directories not files. Is there any option with the command ls? Or is there any utility for doing that?  EDIT: I'm using Mac OS X, and ls -d gives me . even though I have directories.
38340
Is there a command to show the directory/file name when cat files?  For example: assume two files f1.txt and f2.txt are under ./tmp  ./tmp/f1.txt ./tmp/f2.txt    Then when I do cat ./tmp/*.txt, only the content of files will be shown. But how to firstly show the file name, then the content?, e.g.:   (The needed command):  ./tmp/f1.txt:    This is from f1.txt  and so on  ./tmp/f1.txt:  This is from f2.txt ...   Is there a command to do it? (There seems to be no option for 'cat' to show the file names)
66846
How is it possible to use the GNU find command to match several file types at a time (one search command)?  The man page says:  -type c     File is of type c:     b      block (buffered) special     c      character (unbuffered) special     d      directory     p      named pipe (FIFO)     f      regular file     l      symbolic link; this is never true if the -L option or the -follow            option  is in  effect,  unless  the  symbolic link is broken.  If            you want to search for symbolic links when -L is in effect, use            -xtype.     s      socket     D      door (Solaris)   and I want to search for files (f) and symbolic links (l) and pipe it to another process. How can I search for both at the same time?  I have tried  find -type fl | … find -type f -type l | … find -xtype f -type l | …   I know a workaround would be to use a subshell  (find -type f; find -type l) | …   but I just want to know if it is possible.
63290
How can I compile/run C or C++ in Unix console or a Mac terminal?  (I know it, forget it, and relearn it again. Time to write it down.)
16043
I've been having a problem with compiling.   I used the following test C code below and saved it as test.c in Home folder.  #include &lt;stdio.h&gt; int main() {   printf("Bruh!");   return 0; }   When I run in terminal the code   gcc test.c -o test   I get  nothing.  Thank you
79643
I wanted to know, what is the best way to use the find command efficiently?  I generally use, find [filename] [dir] which gives me a long list of file names none of them any way related to my search.  I simply need to find one file in a particular directory. What is the command for that?
55783
I am trying to run grep against a list of a few hundred files:  $ head -n 3 &lt;(cat files.txt) admin.php ajax/accept.php ajax/add_note.php   However, even though I am grepping for a string that I know is found in the files, the following does not search the files:  $ grep -i 'foo' &lt;(cat files.txt)  $ grep -i 'foo' admin.php The foo was found   I am familiar with the -f flag which will read the patterns from a file. But how to read the input files?  I had considered the horrible workaround of copying the files to a temporary directory as cp seems to support the &lt;(cat files.txt) format, and from there grepping the files. Shirley there is a better way.
117694
I know that unix has man pages, but is there a place I can look to discover command-line arguments of programs? Going to command prompt and typing notepad /? doesn't give anything.
101920
How can I convert a relative path to an absolute path in C on Unix? Is there a convenient system function for this?  On Windows there is a GetFullPathName function that does the job, but I didn't find something similar on Unix...