linux

Overwriting library file causes segmentation fault

After I have the executable file running I overwrite its .so library file with a new version and this causes the executable to die with segmentation fault. I thought the library file is being accessed only when ELF file is loaded. Am I wrong? ...

Symbolic link for html file with an embeded flash swf located in different directory in redhat or centos Linux

Hi All, I have created a html index.html which has an embeded code linking to index.swf in an folder both these file are in the path say /home/user-name/ When i created a symbolic link to index.html in the path /home/user-name/Desktop . when i click on the symbolic link index.html file it opens in the browser but the flash file inde...

Closing a listening TCP socket in C

Hi; Suppose you have a socket listening on a TCP port, and some clients are connected. When one issues sock_close(fd) in C and tries to bind again on the same port, binding fails. Some TIME_WAIT state is seen on the "netstat -plutnoa" such as: tcp 0 0 127.0.0.1:4567 127.0.0.1:32977 TIME_WAIT - ...

Need Help Extracting embedded ole from office files programmatically under Linux (python or c or any program that is console).

Hello SO i am having trouble trying to extract embedded documents inside Office <2003 . I am able to parse and index office files but i need to index embedded ole documents also. How can i achieve? Any lib for python or command line programs? i found ripole: www.pldaniels.com/ripole/ , but it just giving me Segfault.. I need native p...

Differences between a shared object and an ordinary library in Linux

What are the main differences between binding to a shared object or to an ordinary object? Also how is this possible to share some variables between some programs and knowing that our variables are never changed by another program? ...

How to use grep with regex to find all the files conatining a 'String'?

HI All, I am new in Unix, I am using SSH secure shell,i want to search file with some 'TEXT' or string and that string is like 'PACKAGE',followed by '%PA%EVENTS%'('PA_PACKAGE %PA%EVENTS%') this % i am assuming as in SQL*PLUS,means i a string PA can occur any where before EVENTS and EVENTS can occur any where after PA, I want to search th...

su and sudo in a shell script

There is a shell script (/bin/sh, not bash) that requires root permissions for execution. If it is ran by a normal user it should ask user a password to get root access and re-run itself. Now it uses the following code: if [ $(id -u) -ne 0 ]; then su root -- $0 $@ ; ... fi That works fine, but there are some OS like Ubuntu that has n...

Check whether a certain file type/extension exists in directory

How would you go about telling whether files of a specific extension are present in a directory, with bash? Something like if [ -e *.flac ]; then echo true; fi Thanks ...

Using hardware timer in C

Hi guys, Okay, so I've got some C code to perform a mathematical operation which could, pretty much, take any length of time (depending on the operands supplied to it, of course). I was wondering if there is a way to register some kind of method which will be called every n seconds which can analyse the state of the operation, i.e. what...

Why is printing to stdout so slow? Can it be sped up?

I've always been amazed/frustrated with how long it takes to simply output to the terminal with a print statement. After some recent painfully slow logging I decided to look into it and was quite surprised to find that almost all the time spent is waiting for the terminal to process the results. Can writing to stdout be sped up somehow...

How to use a customized font in tty

Question: I want to use customize font(Eg: dejavu) in tty. Tried: dpkg-reconfigure console-setup setfont Result till now: There are only fonts under /etc/share/consolefonts/ can be used in command "setfont". And now the question: Is it possible to use dejavu in tty? If it is, how? Thanks! ...

How to set the maximum TCP mss (Maximum Segment Size) on Linux?

A simple question: In Linux, how do you set the maximum segment size that is allowed on a TCP connection? I need to set this for an application I did not write (so I cannot use setsockopt to do it). I need to set this ABOVE the mtu in the network stack. Here's why: I have two streams sharing the same network connection. One sends s...

checking when all data is sent using non-blocking open

If I open a a file as os.open( '/dev/ttyS2', O_RDWR | O_NDELAY ), is there any way that I can check when my 'write()' commands have finished? Or, can I open a file for non-blocking read but blocking write? ...

Help using objdump : disassembling to arm

hi, I have an object file and am trying to disassemble it. When i use: objdump -d example.o i get an assembly in code in the file format of elf64-x86-64 i am trying to disassemble this into ARM, how do i go about doing this? Thanks, Steve ...

In Linux using C++ and GCC, is it possible to convert the virtual address to a physical address?

Under Linux, C++, and GCC, can I get a physical address for a given virtual address? I know I won't be able to manipulate the physical address as a physical address. ...

What is the safest way to run an executable on Linux?

I am trying to run a program compiled from C code from an unknown source. I want to make sure that the program does not harm my system in anyway. Like for instance, the program might have soemthing like system("rm -rf /") in the source, which is un-detectable, unless the code is thoroughly examined. I thought of the following 2 ways ...

any scripting language can read AJAX/Java Script? (linux)

is there any way I can scrape web pages that uses AJAX? by using something like ruby + mechanize on linux server that doesn't have monitor attached (linode.com for example) http://watir.com/ would be a solution but I guess not applicable to linode. ...

Using Coda to access server SSH/sFTP

Hi, I have a VPS server and I lock down to only expose 3 ports 80, 443 and 22222 for ssh. So far I can connect to the server using Terminal (Mac) and Panic Transmit, but when I try to connect using Panic Coda the connection fail. What I am doing wrong? I see Coda support sFTP and I can connect on Coda to the SSH, but not to the sFTP. ...

Why can't I directly start a shared library in Linux?

$ chmod +x libsomelibrary.so $ ./libsomelibrary.so Segmentation fault $ gcc -O2 http://vi-server.org/vi/bin/rundll.c -ldl -o rundll $ ./rundll ./libsomelibrary.so main (application starts normally) Why can't I just start libsomelibrary.so if it has usable entry point? rundll.c is trivial: void* d = dlopen(argv[1], RTLD_LAZY); void* ...

Read contents of a pdf file

Is there a commandline tool to read a pdf file on linux.Please indicate the appropriate urls for this. Thanks.. ...