Kernel word recovery crack, Mobile themes website for samsung wave 525, Dekha ek khwab sony tv title song, Song zombies on your lawn, Bloody mary nerve endings mp3, Digittrade tv jukebox, Padosan songs mp3, Gold cup series 70 manual, Nieuwste versie van mozilla firefox en, Cant install spotify on mac, Web brute force password cracker, Belkin g peek driver windows 7

Linux tool to list open files

February 23rd, 2011 by Martijn Leave a reply »

There is a tool named lsof that can display which file descriptors are opened by a process. Although it’s very useful, it can be a bit difficult to use, and doesn’t always output the information I need, thus urging me to write a new tool. It is called _of_, it is written in perl and uses the /proc filesystem to get its information. It requires a Linux system with a kernel 2.6.22 or more recent.

### Examples

Some examples to show what it does follow.

List the pid, process name and filename of the files opened by processes that match the name vim:

$of vim
10059 vim.gnome /home/stilgar/bin/.of.swp

List files opened by evolution and only display their filename:

$of --fields f evolution | grep "\.db$" | sort | uniq

List all the pipes that are opened by ogmrip and its children (in this case mencoder). This allows us to see what information ogmrip exchanges with mencoder, and in this case retrieve information about mencoder’s progress:

$of --type p --children --show-fd ogmrip
2054 ogmrip 19 pipe:[15582]
2054 ogmrip 20 pipe:[15582]
2054 ogmrip 23 pipe:[912459]
2054 ogmrip 25 pipe:[912460]
16132 mencoder 1 pipe:[912459]
16132 mencoder 2 pipe:[912460]
$cat /proc/2054/23
 Pos: 216.6s   5415f (45%) 31.04fps Trem:   3min  45mb  A-V:0.000 [803:0]

Use an environment variable to set a default output format:

$export OF_RC=$'--fields pndlhsf --format "%5d %-15.15s %3d [%-3s] %-7s %-7s %s\n" --unit h'
$of gnome-session -c
1670 gnome-panel       2 [RW+] 2.0K    2.0K    /home/stilgar/.xsession-errors
1678 nautilus          1 [RW+] 2.0K    2.0K    /home/stilgar/.xsession-errors
1678 nautilus          2 [RW+] 2.0K    2.0K    /home/stilgar/.xsession-errors

Which devices does the totem media player open ?

$of totem -c -t v
20360 totem /dev/null
20360 totem /dev/snd/timer
20360 totem /dev/snd/pcmC0D0p

### Selecting processes

#### Process matching

Any number of process names can be provided as arguments. If no process name is specified, _of_ will use all the processes belonging to the current user.

The specified process names are matched against _/proc/*pid*/cmdline_, _/proc/*pid*/exe_ and _/proc/*pid*/status_.

At this time _of_ only shows descriptors that are opened by the user calling the command. Future versions will allow users with root privileges to use it on other users.

#### Options


: Recurse into the selected processes’ descendance.


: Ignore case in matching algorithm.


: Match incomplete process name (ie. _fire_ matches _firefox_)


: Match the script file instead of interpreter for known script languages.

### Selecting descriptors

A few options are provided to select which descriptors to display. By default only directories and regular files are be displayed.

`–types [dfvpsxoDFVPSXO]`
`-t [dfvpsxoDFVPSXO]`

: Select which descriptors types to display (directories, regular files, devices, pipes, sockets, deleted, other special)

`–include [dfvpsxo]`
`-n [dfvpsxo]`

: Include these descriptor types. See `–types` for the meaning of the arguments.

`–exclude [dfvpsxo]`
`-x [dfvpsxo]`

: Include or exclude file types. See `–types` for the meaning of the arguments.


: Display descriptors of any type.


: Only display deleted entries. Implies `–include x`.


: Select which descriptor types to display.

### Output format

#### Fields

Fields are displayed in command-line order.


: Enable/disable fields to display.


: Display all fields.

`–fields [pndlxfhs]`
`-f [pndlxfhs]`

: Choose which fields to display (pid, process name, fd, flags, extra flags, filename, seek position, size).

#### Output format

`–unit [bkmh]`

: Unit to use for sizes (bytes, kilobytes, megabytes, human)


: Shell escape filenames.


: Display basename instead of full filename.

`–format format_string`
`-o format_string`

: sprintf style format string to display files. The “%” placeholders must match the selected fields (`–fields`) in number and in order.

`–formatln format_string`
`-O format_string`

: like –format, but appends a newline.


: End lines with nul character instead of a newline. This is useful in combination with `xargs -0` to safely iterate over filenames that may contain weird characters.

### Miscellaneous


: Display a useful help message.


: Display the current version and quit.

Attached Files:

  • txt of

    List open files


Leave a Reply

Authorized tags:
[b]bold[/b] [u]underline[/u] [i]italic[/i] [url=http://link.url]link[/url] more