linux

List files recursively in linux with path relative to the current directory

This is similar to this question, but I want to include the path relative to the current directory in unix. If can do the following: ls -LR | grep .txt But it doesn't include the full paths. For example, I have the follow dir structure: test1/file.txt test2/file1.txt test2/file2.txt The code above will return: file.txt file1.txt f...

how to fix, GRUB error 17 problem on laptop without working CD Reader

I broke the laptop. how did I break it? I remember feeling happy about wubi. now I feel bad about wubi and everything that I did. I used the partition editor within Windows (System Tools - administration) and removed my 11 GB partition of ubuntu. This was how my laptop has been partitioned EVER since I dual booted it three or so years...

SSH, screen and XDISPLAY

I use screen to persist my work session and connect to the same session from multiple machines. How can I setup SSH and screen such that the XDISPLAY variable inside my persistent screen session is always set to the machine I am currently connecting from? ie. I start the screen session at work and use gvim, which uses the X server runni...

Best way to extract mac address from ifconfig output ?

Hi I want to know what is the best way to extract MAC Address from ifconfig output. bash-3.00# ifconfig eth0 eth0 Link encap:Ethernet HWaddr 1F:2E:19:10:3B:52 inet addr:127.0.0.66 Bcast:127.255.255.255 Mask:255.0.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 .... ...

SNMP payload address translation

I'm using iptables under linux to NAT SNMP traffic. Some of the SNMP packets have VARBINDs that contain the (real) IP addresses of the devices that generated them. This confuses standard management tools, which need to see the NATted addresses in the VARBINDs. So I need to translate the addresses in the payload in addition to those in...

How to determine whether a given Linux is 32 bit or 64 bit?

When I type uname -a, it gives the following output. Linux mars 2.6.9-67.0.15.ELsmp #1 SMP Tue Apr 22 13:50:33 EDT 2008 i686 i686 i386 GNU/Linux How can I know from this that the given OS is 32 bit or 64 bit? ...

How to add display a message in linux commandline upon logging in?

There are certain messages which i wish to display to the personal who is doing putty to a linux shell. How do i like configure some kind of welcome message when people login to the linux shell? ...

How can I list files with their absolute path in linux?

I want to generate recursive file listings with full paths /home/ken/foo/bar but as far as I can see both ls and find only give relative path listings ./foo/bar (from the folder ken) It seems like an obvious requirement but I can't see anything in the find or ls man pages. ...

How to set up GRUB in a cloned hard disk

My PC has a hard disk at /dev/hda and boots from its MBR using the GRUB bootloader. I connected a second hard disk at /dev/hdc, formatted it and copied to it all files from my original hard disk. Now I want to make the second hard disk bootable, when it is connected as the primary hard disk (i.e. as /dev/hda). (The second hard disk has ...

How do I prevent two OSes from clobbering grub files?

I want to install Linux and OpenSolaris on the same hard disk in different partitions. I'm worried because OpenSolaris seems to actively manage the grub data when updating the OS (part of the "boot environment" feature). Is there anything I should prepare for to prevent my grub data from getting clobbered. If I later want to add anoth...

Open Browser window from Java program

Question I have an application written in Java. It is designed to run on a Linux box standalone. I am trying to spawn a new firefox window. However, firefox never opens. It always has a shell exit code of 1. I can run this same code with gnome-terminal and it opens fine. Background So, here is its initialization process: Start ...

Is there something between a normal user account and root?

I'm developing an application that manages network interfaces on behalf of the user and it calls out to several external programs (such as ifconfig) that requires root to make changes. (Specifically, changing the IP address of a local interface, etc.) During development, I have been running the IDE as root (ugh) and the debugger as root ...

How can I record what process or kernel activity is using the disk in GNU/Linux?

On a particular Debian server, iostat (and similar) report an unexpectedly high volume (in bytes) of disk writes going on. I am having trouble working out which process is doing these writes. Two interesting points: Tried turning off system services one at a time to no avail. Disk activity remains fairly constant and unexpectedly hi...

How can a process intercept stdout and stderr of another process on Linux ?

I have some scripts that ought to have stopped running but hang around for ever. Is there some way I can figure out what they're writing to stdout and stderr in a readable way ? I tried, for example, to do tail -f /proc/(pid)/fd/1 but that doesn't really work. It was a long shot anyway. Any other ideas ? strace on its own is quite...

How to determine if a directory is on same partition

Say I have an input file, and a target directory. How do I determine if the input file is on the same hard-drive (or partition) as the target directory? What I want to do is the copy a file if it's on a different, but move it if it's the same. For example: target_directory = "/Volumes/externalDrive/something/" input_foldername, input_f...

Lean Software (Webapplication) Release Engineering

Hi, I'm looking to re-organize the way we release our internal software. All of the code (PHP webapps, some Java apps and Perl scripts) is checked into Subversion repositories but there are no branches or tags, everything is checked into trunk (only around 1-3 devs per app). On the production linux servers, the software is just directly...

How do I debug GRUB handing on "GRUB Loading stage2..." ?

I've seen this asked a lot around on the internet, with no satisfactory answers or root cause. Sometimes it's just 'well, replace your RAID controller', or 're-run grub install', etc. I'm running into this issue on a substantially large amount of hosts as to convince me there's some non-hardware reason it's happening - but it's also no...

What is Your Experience with TaskJuggler?

We are an all Unix shop (Solaris, Linux). This last product cycle I returned to a project lead capacity, and needed to produce a schedule. I asked what tools my managers would accept, and was surprised to hear "text files". My teammate and I gamely tried this, and probably worse, HTML tables, to track the tasks we wanted to size. It was ...

Ruby and linux, prefered setup?

Mac's have TextMate as there preferred application for ruby development, but what would be the preferred application for linux? I need something where it's easy to work with multiple files, project structure and setup commands to run my ruby app or if it is one my merb app.Syntax highlighting is also a must. Now I typically use Vim, but...

Best approach to writing a generic installer for a Linux application?

We have a Linux server application that is comprised of a number of open-source tools as well as programs we've written ourselves. Ideally we would like to be able to install this application on any common Linux distribution. In the past, we've written perl scripts to automate installs of this application. Unfortunately, due to idiosync...