I am used to use what to find out some version string in my program, which is normal defined as a string in the c++ code, starting with “@(#)”. Now I cannot find it in Linux. Can anyone tell me what I am supposed to do? Thanks a lot! Answer The what command is part of the Source Code Control
Tag: linux
C system function causes error ‘sh: Syntax error: “(” unexpected ‘
I wrote a simple program in C on Linux to delete all the files in a directory except one called svn like this: But when I compile and run it, the terminal says: sh: Syntax error: “(” unexpected However, when I type and run the command in the terminal directly, all things are done correctly. Any id…
How to specify ignore pattern in grep?
How can I make grep to ignore some files (e.g. .svn directories, binary files, etc.) while grepping recursively? Answer Use an –exclude pattern as already answered here
Linux kernel module compiling
I try to compile simple linux kernel module: My makefile: Now i haven’t errors in my .c file. But when i try make in terminal: make: Nothing to be done for `all’. What’s wrong? Thank you. Answer The default command in your makefile is That instructs make to cd to /lib/modules/$(KVERSION)/bui…
Can I squeeze my own program between the preprocessor and compiler?
Is this a stupid question, or can I specify g++ to use a program between the preprocessor and compiler? Alternatively, I know that I can just run the preprocessor on a file (hence all the files). Then I am guessing there is a switch to run only the compiler. So I can manually invoke these two and put my progr…
Python 2.7 cannot import PyQt4
I’ve upgraded to Python 2.7 from Python 2.6 on Ubuntu Maverick Meerkat (10.10) and I’m unable to import PyQt4. I installed both Python 2.7 (python2.7) and PyQt4 (python-qt4) from the Ubuntu repositories. I installed PyQt a while back, but I installed Python 2.7 recently. If I try Python 2.6 (since…
200,000 images in single folder in linux, performance issue or not?
I have a php/mysql website with over 200,000 images in single folder (linux server). I don’t think, that I will never need to see them in file explorer, instead they will be viewed on website on their individual pages. They are just displayed in product page on website. File system is ext3. so is it wis…
How can I format my grep output to show line numbers at the end of the line, and also the hit count?
I’m using grep to match string in a file. Here is an example file: grep -i null myfile.txt returns How can I return matched lines together with their line numbers like this: I know -c returns total matched lines, but I don’t how to format it properly to add total null count in front, and I donR…
Splitting gzipped logfiles without storing the ungzipped splits on disk
I have a recurring task of splitting a set of large (about 1-2 GiB each) gzipped Apache logfiles into several parts (say chunks of 500K lines). The final files should be gzipped again to limit the disk usage. On Linux I would normally do: The resulting files files will be named xaa, xab, xac, etc So I do: The…
How does a C compiler find that -lm is pointing to the file libm.a?
What’s .a files in C programming in linux ? Is it library file ? Here how compiler find that -lm is pointing to the file libm.a , and -lsocket as libsocket.a ? And if we add the header file to the program, Is it must we want to mention library while compiling ? Answer As Ignacio says, .a files are