linux

Is there a simple way in linux to strip a website of text from command line?

I've been searching for a command line tool that would turn html code into just the text that would appear on the site... so it would be equivalent to in a web browser selecting everything and then pasting it into a text editor... Anyone know of something in Ubuntu that would do this? I'm trying to write a script to parse some webpages...

How to turn a regular file into a symlink on Linux

I'm writing an (un)archiving tool and the way it is designed it first creates a regular file from the archive before it examines the special attributes and may decide that this item is a symlink, in fact. Note: Before more people misunderstand me for wanting to make a symlink of a file. No, I write the symlink data, i.e. its path, into ...

Regarding UNIX Move Command Override Protection

Pasted a piece of code from the shell script transfer.sh if [[ ${ld} -eq ${eld} ]] ; then mv "$file1" "$FILESNEW/." if [ $? -ne 0 ]; then echo "Move Command Failed-File ${fspec}" fi echo "File ${fspec} Sucessfully Moved to ready directory " else e...

Modify excel file in python on linux enviroment

hi, how do i insert few row in an existing excel file using python? the excel file maybe be of any excel version. On windows that could have been possible by using win32com.client...but i need to make the changes in the linux environment. how can i do it? ...

Is it possible to signal handler to survive after "exec" ?

I wrote a signal handler for a process, and fork() after that, the signal handler will be applied to both parent and child processes. If I replace the child process with "exec", the signal handler is no more. I know this happens because "exec" call will overwrite the child process address space with it's own. I just want to know if ther...

compiling linux kernel with non-gcc

Hello. Linux kernel is written for compiling with gcc and uses a lot of small and ugly gcc-hacks. Which compilers can compile linux kernel except gcc? The one, which can, is the Intel Compiler. What minimal version of it is needed for kernel compiling? There also was a Tiny C compiler, but it was able to compile only reduced and speci...

How to disable the automatic middle-click mouse events in X (Xlib)?

I am currently implementing a program in X11 using C. I got the program to handle right- and left-click events, however middle-clicking poses a problem. It seems my window manager (Gnome on Ubuntu 9.10) thinks it's better if, instead of having a single middle-click, I should have a series of other clicks instead. I assume it's got someth...

Why do I get a SIGABRT here?

I have this code segment in which I am opening/closing a file a number of times (in a loop): for(i=1;i<max;i++) { /* other code */ plot_file=fopen("all_fitness.out","w"); for (j=0;j<pop_size;j++) fprintf(plot_file, "%lf %lf\n",oldpop[i].xreal[0],oldpop[i].obj); fclose(plot_file); /*other c...

How can I find out what these files or processes do (linux)

When I go onto a *nix system and look as ps -A or -e or top I get a large number of processes that are running. For example. init migration/0 ksoftirqd/0 events/0 khelper kacpid kblockd/0 khubd pdflush pdflush kswapd0 aio/0 kseriod scsi_eh_0 kjournald udevd kauditd kjournald kjournald kjournald kjournald kjournald klogd portmap rpc.idm...

Coredump in Multithreaded application in Linux

I am working on multithreaded application,When ever process dumps it showing like this.I am not abe to Analyaze the core.I want to know whether there is any problem while linking with the libraries?kindly suggest how to get more information about my core dump ################################################## GNU gdb Red Hat Linux (6....

passing contents to EDITOR and getting the results after quit (e.g. git/svn commit)

I would like to write a command line tool that passes some formatted text to whatever EDITOR the user has set in the environment and then reading the contents back. How do tools like svn commit and git commit handle this behavior? Is there a standard pattern for doing this? ...

Append number to filenames when flattening directory structure on Linux

I have a directory structure that looks like this: /a/f.xml /b/f.xml /c/f.xml /d/f.xml What I want to do is copy all the xml files into one directory like this: /e/f_0.xml /e/f_1.xml /e/f_2.xml /e/f_3.xml How can I do that efficiently on the Linux shell? ...

Setting up a cross-compilation environment for a specific target platform

I'd like to set up a cross-compilation environment on a Ubuntu 9.10 box. From the documents I've read so far (these ones, for example) this involves compiling the toolchain of the target platforms. My question is: how do you determine the required version of each of the packages in the toolchain for a specific target platform? Is there ...

Where is a file mounted?

Given a path to a file or directory, how can I determine the mount point for that file? For example, if /tmp is mounted as a tmpfs filesystem then given the file name /tmp/foo/bar I want to know that it's stored on a tmpfs rooted at /tmp. This will be in C++ and I'd like to avoid invoking external commands via system(). The code should ...

What is a reliable way to determine which shared library will be loaded across linux platforms?

Hello, I need to find out which library will be loaded given in the information returned from /sbin/ldconfig. I came up with the following: #!/bin/bash echo $(dirname $(/sbin/ldconfig -p | awk "/$1/ {print \$4}" | head -n 1)) Running this results with: $ whichlib libGL.so /usr/X11R6/lib This a two part question: Will this produ...

Is there a way to execute a .exe CGI application on Linux + Apache

I have to migrate a web server from Windows + IIS to Linux + Apache, but there are some webpages rely on .exe CGI applications (some financial calculators) to generate the outputs. Is there an easy way to get this job done? BTW, I don't have the access to the source code of those .exe file. Even though I have, it would take a long time...

Is it possible to have a common pointer between 2 different programs on the same computer

I need 2 different programs to work on a single set of data. I have can set up a network (UDP) connection between them but I want to avoid the transfer of the whole data by any means. It sounds a little absurd but is it possible to share some kind of pointer between these two programs so that when one updates it the other can simple get...

In a PHP / Apache / Linux context, why exactly is chmod 777 dangerous?

Inspired by the discussion in this question, a maybe stupid question. We have all been taught that leaving directories or files on Linux-based web hosting with the permission level of 777 is a bad thing, and to give always as little permissions as necessary. I am now curious as to where exactly lies the danger of exploitation, specific...

Skip compile-time symbol resolution when building Linux shared libraries with dependencies

Is there a gcc flag to skip resolution of symbols by the compile-time linker when building a shared library (that depends on other shared libraries)? For some reason my toolchain is giving undefined reference errors when I try to build shared library C that depends on B.so and A.so, even though the dependencies are specified and exist. I...

How do I write a web server in C on linux

I am looking into developing a small (read:rudimentary) web server on a linux platform and I have no idea where to start. What I want it to be able to do is: Listen on a specific port Take HTTP post and get requests Respond appropriately No session management required Has to be in C or C++ Has to run as a service on boot I am famili...