descriptionRandom linux/unix utilities
ownersedaj2@gmail.com
last changeTue, 2 Jun 2009 20:10:39 +0000 (2 22:10 +0200)
content tags
add:
readme
Random linux/unix utilities, published mostly for the purpose of passing Y36PR2 class. A brief summary of the tools:
cache
-----

posix_fadvise() frontend. May be used to "cache" or "uncache" given files.



createsparse
------------

Creates a set of sparse files (as specified on the command line) of given size.
(Inside it is just fopen() folowed by fseek(), putc() and fclose(), nothing
more.)

Usage: createsparse <size[kKmMgG]> <filename> [filenames ...]



fadvise
-------

write(), fwrite{,_unlocked}(), read(), fread{,_unlocked}(), close(), fclose()
wrapper using posix_fadvise().

When a dynamically linked program is run via this, it will have changed the
caching behavior. It is rather crude (calling posix_fadvise() for every call of
the functions), yet useful. Especially the default "don't cache" mode. Imagine
you need to copy a huge directory from one disk to another, knowing that after
the copy is done, you won't use it anymore. This tool advises the kernel that
this file won't be needed anytime soon.

Usage: fadvise program [that program options]



mark
----

Very simple socket() wrapper. Calls setsockopt(... SO_MARK ...) for every
AF_INET socket() call. Mark is specified as an env. variable (or defaults to
1).

Useful when you need some means to classify packets from usermode to later
apply policy routing (via fwmark).

Usage: MARK=some_number mark program [that program options]



newns
-----

clone() frontend which sets the "unshare" flags (CLONE_NEWNS, CLONE_NEWPID,
CLONE_NEWUTS, CLONE_NEWUSER, CLONE_NEWIPC). Useful for playing with
*-namespaces (notably PID namespaces).

Usage: newns [options] -- program [that program options]



nodevrandom
-----------

{,f}open{,64}() wrapper that intercepts opening of /dev/random and changes the
opened file to /dev/urandom, therefore preventing the program to block
"forever". Some bad program are written in a way that they open /dev/random
(which may block very very long for new entropy to arrive).

Usage: nodevrandom program [that program options]



setrlimit
---------

setrlimit() frontend. It does pretty much the same as shell's "ulimit" builtin
does, except that it is NOT shell builtin. Imagine you are in a VERY memory
restricted environment. Then even running a shell just to set some limit is way
too much overhead. This tool is handy for example for chroot environments ...

Usage: setrlimit [options] -- /path/to/executable [arguments]



sha256sum
---------

Chesumming tool. Does pretty much the same job as "vanilla"
{md5,sha1,sha256}sum, except that it supports crc32 as well (not much win
there, actually) and by default generates an auxiliary record that contains the
file size as well.



sparse
------

Reads standard input and ouputs a file with "holes" (a sparse file) when the
filesystem supports it. Useful for disk image files kept on filesystem (e.g.
virtual machines, ...)

Usage: sparse new_file < old_file



tos
---

socket() wrapper similar to mark. Classifies packets by ToS (type of service).
Don't use unless necessary. Use mark instead where possible.



xtma
----

Simple X program that draws a fullscreen black window (with no decoration
whatsoever). Useful when you play windows games in wine in pseudo-fullscreen
(vitual desktop). Just run xtma in some desktop, run the wine game, make it
fullscreen, switch to xtma and back and ... the pseudo-fullscreen doesn't
contain the window manager crap anymore. YMMV.

shortlog
2009-06-02 hondzaInitial commit.master
heads
14 years ago master