linux

How to initialize a file system?

I have some partitions on /dev/sda. I want to remove them all of them programatically. One way is to list all partitions and then delete them one by one. Another way is to just execute dd if=/dev/zero of=/dev/sda The first option failed when I got some problem with my partition table due to which the listing of the current partitions ...

Deleting up to a certain line in vim

I know that to delete n lines, the command is [n]dd, where n is the number of lines to delete. But what if I want to delete up to a certain line number? Say, if I'm on line 65 and I want to delete up to line 126 without having to do the math, how could I do that? ...

What c lib to use when I need to parse a simple config file under linux?

Hi Let's say I have a simple config file that my c program needs to read/parse. Let's say it looks a little bit like this: #Some comment key1=data1 key2=data2 Is there a standard c lib that I can use instead of writing my own parser? Thanks Johan Note: Today I have my own little parser, but there must be some standard libs that...

Is there a linux command to determine the window IDs associated with a given process ID?

Given a process iD of XX, I'd like to have a list of any window id's where _NET_WM_PID = XX. Even better would be the oldest still active window id if possible. I'm very new to linux, but what I'm trying to do is create a script that would take a command line, and see if there's a windows already open belonging to a process invoked wit...

Creating a wine static executable?

Hi, I have some windows command line applications, in binary form (I do not have the source code) which I use frequently. Sometimes I need to run them in Linux machines, and it works perfectly under wine (wine is not an emulator). The problem I'm facing now is that I need to work on a cluster which has not wine installed on it. I wonder...

Core dump in linux

I want to create a core dump whenever my process crashes. Currently I am following this approach: Build a special "debug" version of the program using "-g" of gcc/g++. Execute "ulimit -c unlimited" Now we get the core dump whenever the program crashes. But I want to minimize the number of steps so that: Core dump should always get ...

(How) Can I reduce socket latency?

Hello, I have written an HTTP proxy that does some stuff that's not relevant here, but it is increasing the client's time-to-serve by a huge amount (600us without proxy vs 60000us with it). I think I have found where the bulk of that time is coming from - between my proxy finishing sending back to the client and the client finishing rece...

linux - detecting change of system time

Is there a way to get notified when there is update to the system time from a time-server or due to DST change? I am after an API/system call or equivalent. It is part or my effort to optimize generating a value for something similar to SQL NOW() to an hour granularity, without using SQL. ...

Simplest way to manage centralized git repositories on a Linux box ?

I want to use my Linux home server as a central repo for having access to my git projects anywhere. I've heard about gitosis, but was wondering if there might be a simpler/better way, maybe more native to linux and git itself (i.e. no python), to do this ? ...

Linking to libraries in gcc

I have a collection of dynamic libraries that I want to link to in /usr/local/lib, how can I do this using gcc without setting my LD_LIBRARY_PATH (i have heard it is bad to do this fora number of reasons). I have spent an hour looking at this on the internet, and fiddling with command line arguments, the only way I got it to work was usi...

Error number 13 - Remote access svn with dav_svn failing

I'm getting the following error on my svn repository <D:error> <C:error/> <m:human-readable errcode="13"> Could not open the requested SVN filesystem </m:human-readable> </D:error> I've followed the instructions from the How to Geek, and the Ubuntu Community Page, but to no success. I've even given the repository 777 permissions. ...

Windows and *nix compilation detection

One project should be compiled for Windows, Linux and an embedded target. The application has behavior differences when running on host or embedded targets. To summarize my requirements, here is the table: Target Compiler Behavior Windows MSVC, gcc A Host Linux gcc ...

How can I run and end the script() linux command from Perl?

#!/usr/bin/perl $sim = "multiq"; `make SCHED=$sim`; `script > scripter`; `echo hi`; print pack("c", 04); ~ This script hangs when script is called. Not sure how to get the perl script to keep running. ...

How do you specify $? options in an rpm file

I'm trying to build freetds but want it to include the static libraries in freetds-devel. It looks like it takes an option _with_static but it's unclear to specify it. Here's a section of the RPM file: %build %configure \ --disable-dependency-tracking \ --disable-rpath \ %{!?_with_static: --disable-static} \ ...

.htaccess 301 redirect problem

I have the following two 301 redirects in my .htaccess file. The first redirect /faq.php works fine but the second one just gets a 404 error. Can anyone suggest why this may be happening? Options +FollowSymLinks RewriteEngine on redirect 301 /faq.php http://www.mysite.com/faqs redirect 301 /reports/index.php?regionid=14 http://www.my...

ApacheBench result to a file

I would like to save ApacheBench (ab) tool on linux to a file. When I run it with -v 2 it displays some results in my ssh window. How to move these data into a file and make sure that it will not display on ssh no more? I've tried > file.txt but it does not work and still display data in my ssh window. ...

Is there a way to check which order symbols are loaded into an application in linux?

I know that there is the /proc/proc#/maps file that shows the libraries that are loaded, but is there a way to find out in which order the symbols are loaded? ...

changing the process name of a python script

Is there a way to change the name of a process running a python script on Linux? When I do a ps, all I get are "python" process names. ...

Recommended Django Deployment

Short version: How do you deploy your Django servers? What application server, front-end (if any, and by front-end I mean reverse proxy), and OS do you run it on? Any input would be greatly appreciated, I'm quite a novice when it comes to Python and even more as a server administrator. Long version: I'm migrating between server hosts, s...

module: command not found

I'm attempting to load several modules for building a library on Linux but am told that the command 'module' doesn't exist. I've Googled around and discovered that the solution was to source a directory called "module" which I am unable to locate despite extensive searching. I'm not quite sure what I should and any help would be appreci...