linux

cd doesn't work when redirecting output?

Here's a puzzler: can anyone explain why cd fails when the output is redirected to a pipe? E.g.: james@machine:~$ cd /tmp # fine, no problem james@machine:~$ cd /tmp | grep 'foo' # doesn't work james@machine:~$ cd /tmp | tee -a output.log # doesn't work james@machine:~$ cd /tmp >out.log ...

Limit in the memory and cpu available for a user in Linux

Hello, I am a little concern with the amount of resources that I can use in a shared machine. Is there any way to test if the administrator has a limt in the amount of resources that I can use?. And if does, to make a more complete question, how can I set up such limit?. Thank you. ...

Linux pipe output to grep

I want to pipe the output of grep as the search patter for another grep. As an example: grep <Search_term> <file1> | xargs grep <file2> I want the output of the first grep as the search term for the second grep. The above command is treating the output of the first grep as the file name for the second grep. I tried using -e option fo...

Environment overrides for Linux linker/loader

Earlier today I asked a question about environ, and one of the more interesting replies suggested that I could gather information using LD_DEBUG. Now I've known about some linker/loader environment variables (such as *LD_PRELOAD*) for awhile, but this one was new to me. Googling, I found a Linux-specific man page discussing environment ...

How Do I get the "friendly" name of serial port in Mono and keep it cross platform

I asked this question: http://stackoverflow.com/questions/434494/serial-port-rs232-in-mono-for-multiple-platforms and this one is related: http://stackoverflow.com/questions/304986/how-do-i-get-the-friendly-name-of-a-com-port-in-windows But I want to be able to get the "friendly" name on Windows- and possibly also on linux /mac if ther...

How do I upgrade PHP 5.1 to 5.2 on SUSE 10.1 using the yast command line only?

How do I upgrade PHP 5.1 to 5.2 from the SUSE 10.1 command line? Is there a package manager command to do it automatically? Actually I need JSON support to use the JavaScript-RTE and believe it's in PHP 5.2 only. ...

How do I unlock a folder/file under Linux

Today I had the problem that I couldn't delete a folder because "it was busy". How can I find out which application to blame for that or can I just delete it with brute force? ...

How can I get PHP to use the same APC cache when invoked on the CLI and the web?

I'm using APC to cache user variables (with the apc_store/apc_fetch commands). I've also enabled APC for the CLI with the option "apc.enable_cli = 1". However, the CLI version of PHP seems to access a different APC cache from the version used by Apache. Is it possible to configure APC to use the same cache for both CLI and web invocati...

Database Access Libraries for C++

Background: I have an application written in native C++ which uses the wxWidgets toolkit's wxODBC database access library which is being removed from all future versions of wxWidgets . I need to replace this with another database access method that supports the assumptions and contraints outlined below. I don't require that the replacem...

linux c/c++ programming telnet connection io redirection

I have a computer (say computer A) whenever computer A gets a connection over a particular telnet port, it launches a program. this program on computer A handles login, authentication etc. One of the jobs it can do is receive files. It handles this by launching gKermit. /usr/local/bin/gkermit -e 8000 -w -a /location/x/ -ir I have a s...

SSH "Login monitor" for Linux

I'm trying to write a script that informs the user when someone has logged in on the machine via ssh. My current idea is to parse the output of "w" using grep in intervals. But that's neither elegant nor performant. Has anyone got a better idea how to implement such a program? Any help would really be appreciated! ...

How to find the processor queue length in linux

Trying to determine the Processor Queue Length (the number of processes that ready to run but currently aren't) on a linux machine. There is a WMI call in Windows for this metric, but not knowing much about linux I'm trying to mine /proc and 'top' for the information. Is there a way to determine the queue length for the cpu? Edit to add...

Double quotes in vim/ubuntu?

I apologize profusely for the incredibly newbish question I'm about to ask, but for some reason, my brain's locked up: I'm trying to code in C on gvim on a virtual machine running Ubuntu, but my Hello World throws compiler errors which I suspect has to do with the quotes being different ascii(unicode?) codes than standard quotes. It do...

How can I use this makefile in Microsoft VC?

In the program below, there are two things that I don't understand. How can I use this makefile in Microsoft VC? Why there is a '?' before '='? Program: ifeq ($(TARGET_COMPILER),ms) include ../makefile.ms.config DBG?= /Zi OPT= /Ox CXXFLAGS += $(COMMON_FLAGS) $(OPT) $(DBG) EEXT = $(EXT).dll ifeq ($(GZ...

What is your Linux/Vim cheat sheet?

As a Windows user, I found it difficult to master the Linux and Vim commands. So are there some cheat sheets to look them up into quickly? ...

When to prefer Xampp over a complete installation of Linux, Apache, MySQL, PHP

In which cases, except development, would you prefer Xampp over a complete installation and configuration of Linux, Apache, MySQL, PHP. ...

Forcing driver to device match

I have a piece of usb hardware, for which I know the driver. However, the vendor id and product id do not match the VID, PID pair registered in the driver. Is there a way in linux to force a driver to be associated with a known device, that do not involve kernel module recompilation to add a PID / VID pair ? ...

In Linux, how do I know if an ACK is received to a certain TCP packet?

Long story short: in Linux, how do I ensure that an ACK message is received for a certain TCP packet? Full story: I'm debugging an Asterisk/OpenH323 <-> Panasonic IP-GW16 issue. An H323 connection involves two sessions: H225.0 and H245. These are just two TCP sessions, over which some data are transmitted. Let's call them Session 1 (...

Bash text parsing golf

Hi, I am writing a shell script to, among other things, determine the last time a branch was made in a subversion repository. The following code works: DEV='http://some/svn/server/' BRANCH='some/repos/branches/' LAST_UPDATE=`svn list http://$DEV$BRANCH | sort -r` LAST_UPDATE=${LAST_UPDATE:0:10} But ...

How do you uninstall in *nix?

One of the things I still can't wrap my head around is rules of thumb to uninstall programs in *nix environments. Most of the time I'm happy to let the sleeping dogs lie and not uninstall software that I no longer need. But from time to time I end up with several Apaches, svn, etc. So far here's what I know about dealing with this: 1)...