linux

Why doesn't "cd" work in a bash shell script?

I'm trying to write a small script to change the current directory to my project directory: #!/bin/bash cd /home/askgelal/projects/java I saved this file as proj, changed the chmod, copied it to /usr/bin. When I call it by: proj, it does nothing. What am I doing wrong? ...

What's the Best Mailing List Package? (Linux)

We need a mailing list package similar to Python Mailman. I'd use Mailman except for one thing: we want to link the subscriber list to a table in our MySQL database. We want people to be able to opt in/out and control delivery options directly from our site in addition to via the email interface. I don't think Mailman has an easy way to ...

Populate a MS Access database in Linux

Is there any way to create an Access / Jet database from within Linux? I'm trying to feed data from a linux application server (mysql backend) and have not found any tools that let me do this - it seems there should be something. If I can't create a database, is there a way to insert into an existing Access database file from within Li...

sudo changes PATH - why?

This is the PATH variable without sudo: $ echo 'echo $PATH' | sh /opt/local/ruby/bin:/usr/bin:/bin This is the PATH variable with sudo: $echo 'echo $PATH' | sudo sh /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin As far as I can tell, sudo is supposed to leave PATH untouched. What's going on? How do I ...

Quickly create a large file on a linux system?

How can I quickly create a large file on a Linux (RHEL) system? dd will do the job, but reading from /dev/zeo and writing to the drive can take a long time when you need a file several hundreds of GB in size for testing... if you need to do that repeatedly the time really adds up. I don't care about the contents of the file, I just wan...

How can I detect Gnome Terminal?

I am writing a console application which makes use of the F1 key (for help). Unfortunately, while Konsole (of KDE) doesn't use this key, Gnome Terminal does, so the F1 key becomes inaccessible to my application. I don't think there's a way to detect whether the F1 key is already mapped in the GUI side of things (Gnome Terminal), but if...

How to properly handle wildcard expansion in a bash shell script?

#!/bin/bash hello() { SRC=$1 DEST=$2 for IP in `cat /opt/ankit/configs/machine.configs` ; do echo $SRC | grep '*' > /dev/null if test `echo $?` -eq 0 ; then for STAR in $SRC ; do echo -en "$IP" echo -en "\n\t ARG1=$STAR ARG2=$2\n\n" done else ...

handling lots of temporary small files

I have a web server which saves cache files and keeps them for 7 days. The file names are md5 hashes, i.e. exactly 32 hex characters long, and are being kept in a tree structure that looks like this: 00/ 00/ 00000ae9355e59a3d8a314a5470753d8 . . 00/ 01/ You get the idea. My problem is that deleting old files is taking ...

How do I monitor RAID state on Adaptec cards under linux

How do I monitor RAID state on Adaptec cards (especially ASC-29320ALP) under linux ubuntu 8.04 with kernel 2.6.24-19? The ubuntu works with the BIOS configured RAID perfectly. I am concerned though, that should one of the disks fail, nobody would know until it is too late. Adaptec's site provides only the driver itself: http://www.adap...

Etymology of linux commands

Just for fun ... I tend to keep myself alert by looking for serendipitous puzzles throughout the day. One of the things I love about linux is the never-ending amount of cleverness it embodies, from its elegant simplicity all the way to the comments in its manual pages. Can you articulate the unwritten rules that dictate how new command...

Why do double-quote change the result

I have a simple linux script: #!/bin/sh for i in `ls $1` do echo $i done In my temp folder are 4 file: a.a, a.aa, a.ab and a.ac When i call ./script temp/*.?? i get: temp/a.aa When i call ./script "temp/*.??" i get: temp/a.aa temp/a.ab temp/a.ac Why do the double quote change the result? ...

more efficent shell text manipulation

Hello, I am using this command: cut -d\: -f2 To sort and reedit text, Is there a more efficient way to do this without using sed or awk? I would also like to know how I would append a period to the end of each field At the moment the output is like $x['s'] and I would like it to be $x['s'] . Just using standard unix tools edit: I ...

I need a TCP option (ioctl) to send data immediately.

I've got an unusual situation: I'm using a Linux system in an embedded situation (Intel box, currently using a 2.6.20 kernel.) which has to communicate with an embedded system that has a partially broken TCP implementation. As near as I can tell right now they expect each message from us to come in a separate Ethernet frame! They seem to...

Capturing session for remote control from a linux host

Use case: A does something on his box and gots stuck. He asks B (remote) for support. B logs into the session of A, sees all windows, A was seeing and is able to manipulate the GUI. If A uses Windows it is very convenient to log into a running session e.g. via VNC. But if A uses Linux, AFAIK, this is not possible. Using VNC requires ...

How can you flush a write using a file descriptor?

It turns out this whole misunderstanding of the open() versus fopen() stems from a buggy I2C driver in the Linux 2.6.14 kernel on an ARM. Backporting a working bit bashed driver solved the root cause of the problem I was trying to address here. I'm trying to figure out an issue with a serial device driver in Linux (I2C). It appear...

Finding an IP from an interface name

On a Linux box, the common interface names look like eth0, eth1, etc. I know how to find at least one IP using gethostbyname or similar functions, but I don't know any way to specify which named interface I want the IP of. I could use ifconfig and parse the output, but shelling out for this information seems... inelegant. Is there a w...

What libraries need to be linked for timer_create, timer_settime and other timer related functions

Compiling a program on Linux that calls POSIX timer functions (eg: timer_create, timer_settime) returns errors such as: In function `foo': timer.c:(.text+0xbb): undefined reference to `timer_create' timer.c:(.text+0x187): undefined reference to `timer_settime' collect2: ld returned 1 exit status Which library do I need to link? ...

Packet mangling utilities besides iptables?

I'm looking for a linux utility that can alter the payloads of network packets based on a set of rules. Ideally, I'd use iptables and the netfilter kernel module, but they don't support generic payload mangling: iptables will alter various header fields (addresses, ports, TOS, etc), and it can match arbitrary bytes within a packet, but ...

What program do you use to edit php remotely and then upload to your server?

So I am just starting out developing PHP web applications and have finished setting up my server with the following: Ubuntu Server Apache2 PHP MySQL VSFTPD and all the other goodies... Currently when I edit files, I have two methods to update/upload them to the server. I can use vi on the server to make small changes or I can use Ne...

custom google maps application on which a placemarker moves over the map at locations given to it at intervals--possible?

Hi, I want to know if i can create a custom google maps application,on which a placemarker continuously moves over the map accordingly as its latlongs are changing. If yes...what technologies shall i be using for such a webapp?? can this be done with .NET....Ultimately if this is possible,i will have to use this webapp on RHEL5 OS. Sec...