Linux keeps per-interface statistics, ifconfig reports them just fine.
But does Linux keep per-TCP connection statistics, specifically, how many rx/tx bytes this session? If it does, I sure can't find them.
Can you?
This is a bit pie-in-the-sky but I've learned not to make assumptions about the capabilities of anything, since I'm frequently amazed by hidden features buried in UNIX/Linux tools, so here goes.
I often find myself running commands where I need to locate a file on a system and then once I've eyeballed the location for sanity, I need to do something with the path.
Take this workflow, for instance:
$ which foo.sh
/path/to/something/foo.sh
$ vim `which foo.sh`
That second command takes me 1-2 entire seconds to type. It's madness. I do it so often it's starting to feel like boilerplate that I should be able to factor out.
What I'd love is fantasy shell magic that would let me do the following:
$ which foo.sh
/path/to/something/foo.sh
$ which foo.sh |! vim
This second case is far superior IMO. I find it much easier to type "|! vim" after the up-arrow than I do seeking the start of the line, typing vim backtick, then seeking the end of the line and typing a final backtick.
Imagine the pipe-bang operator doing something similar to "| xargs,vim" but in a way that preserves the terminal for vim and as also something much shorter to type. Pipe-bang is of course a syntax error in bash and it cannot be aliased, so the thing I want to do seems impossible.
Or is it? I suspect this is a case of TMTOWTDI but I'm having a mental block.
It doesn't have to be literally pipe-bang either, but something close is the goal.
Sometimes people delete files they shouldn't, a long-running process still has the file open, and recovering the data by catting /proc/<pid>/fd/N
just isn't awesome enough. Awesome enough would be if you could "undo" the delete by running some magic option to ln that would let you re-link to the inode number (recovered through lsof).
I can't find any Linux tools to do this, least with cursory Googling.
What do you got, serverfault?
EDIT1: The reason catting the file from /proc/<pid>/fd/N
isn't awesome enough is because the process which still has the file open is still writing to it. A delete removes the reference to the inode from the filesystem namespace. What I want is a way of re-creating the reference.
EDIT2: 'debugfs ln' works but the risk is too high since it frobs raw filesystem data. The recovered file is also crazy inconsistent. The link count is zero and I can't add links to it. I'm worse off this way since I can just use /proc/<pid>/fd/N
to access the data without corrupting my fs.
We have some daemons executing on a number of hosts.
The daemon executable images are these very large binaries that are hosted on NFS.
When the binaries are updated on the NFS server, the previously running daemons sometimes drop dead with a Bus error. I'm assuming what's happening is the NFS server is replacing the binaries in a way that's invisible to the VFS layer on the NFS clients so they end up loading pages from the updated binary, which of course leads to madness.
We tried moving the new binaries into place instead of cp, but that doesn't seem to fix it.
I'm considering simply mlock()'ing the binary in the daemon startup script, but surely there's magic NFS options or semantics that we should be abusing. Is there a better way to fix this?
I find myself performing this REPL-like action quite often:
vim foo.sh
scp foo.sh host:/tmp/foo.sh
ssh host /tmp/foo.sh
# realizing it wasn't quite right
vim foo.sh
scp foo.sh host:/tmp/foo.sh
ssh host /tmp/foo.sh
# repeat many times
I was about to plow away at writing a shell script to make this simpler, but was wondering if someone smarter than me solved this problem more elegantly.
What's your solution? Besides emacs :)
EDIT: Why not just edit my file on the remote host? Simple, the hosts receiving my scripts won't always have a dev environment set up, so in this case host might not have all of my vim customizations; sometimes it'll be C code instead of a shell script, which means my workflow looks like:
vim foo.c
make
scp foo host:/tmp/foo
ssh host /tmp/foo
# repeat
That's why. I guess I want something with an interface like:
edit_loop foo.c --make --copy-and-run=host:/tmp/foo
What do you think?
A number of our Windows workstations, running ntpd, simply cannot keep time. Our Linux workstations and servers running the same ntpd config don't have this problem, they can stay within +/- 5ms of skew. The Windows hosts easily drift to seconds and sometimes minutes apart. This is a problem for us.
The only common factor we have been able to isolate is that the hosts that can't keep time are running Windows.
Is there something impossible about what we're trying to do?
EDIT: yes, the Windows workstations are joined to a domain, but ntpd is not synchronizing time against the DCs (the DCs are synchronizing just fine against our ntp sources, FWIW)
EDIT: yes, we do need millisecond accuracy
EDIT: yes, the Windows Time service (W32Time?) is disabled
EDIT: we're running the ntp.org Windows ntpd
I was invited to re-post this question with less opinion, so if it seems familiar, that's why.
How can I convert info pages into man pages? I used to have a shell one liner that flattened an entire info document into a single flat page, suitable for navigating with less, but I seem to have lost it. Please share if you know how to do this. :)
Thanks!