FUSER(1P)

✨ fuser(1P) β€” bestie edition ✨

okay so this is fuser from the POSIX Programmer's Manual πŸ’… and it lives in section 1P. come sit with me, we're gonna go through the whole thing together, no skipping 🫢


🌸 PROLOG 🌸

okay so heads up before literally anything else: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ β€” so if you're on Linux, go check the corresponding Linux manual page for the deets on Linux behavior. orrrr the interface might not even be implemented on Linux at all πŸ™ˆ. vibe check accordingly.


πŸ’– NAME πŸ’–

fuser β€” list process IDs of all processes that have one or more files open. that's it, that's the whole job. it's giving detective energy πŸ”


πŸŽ€ SYNOPSIS πŸŽ€

fuser [-cfu] file...

three little flags, infinite possibilities. slay.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• the fuser utility shall write to standard output the process IDs of processes running on the local system that have one or more named files open.

and bestie, for block special devices, all processes using any file on that device are listed. not just the device itself, the whole device. iconic behavior honestly.

the fuser utility shall write to standard error additional information about the named files, indicating how the file is being used. so stdout gets you the IDs, stderr gets you the gossip about what they're doing with the file πŸ‘€

any output for processes running on remote systems that have a named file open? unspecified. we simply do not know, and the standard is not going to speculate πŸ’€

also β€” a user may need appropriate privileges to invoke the fuser utility. so if it's not working, that might be why. just saying.


✨ OPTIONS ✨

first things first: the fuser utility shall conform to the Base Definitions volume of POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines. very official, very demure.

the following options shall be supported:

  • -c β€” the file is treated as a mount point, and the utility shall report on any files open in the file system. whole filesystem sweep, not just the one file. main character energy.
  • -f β€” the report shall be only for the named files. no extras, no plus-ones, just the files you named. periodt.
  • -u β€” the user name, in parentheses, associated with each process ID written to standard output shall be written to standard error. so you get names with your numbers 🫢

🌈 OPERANDS 🌈

the following operand shall be supported:

  • file β€” a pathname on which the file or file system is to be reported.

that's the one. that's the whole list.


πŸ’œ STDIN πŸ’œ

Not used. she does not read from stdin, she's not listening, she doesn't want your input πŸ™ˆ


πŸ“ INPUT FILES πŸ“

The user database.

(that's the whole thing. the user database. that's where the usernames for -u come from, iykyk)


🧚 ENVIRONMENT VARIABLES 🧚

the following environment variables shall affect the execution of fuser:

  • LANG β€” provide a default value for the internationalization variables that are unset or null. (see the Base Definitions volume of POSIX.1‐2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)
  • LC_ALL β€” if set to a non-empty string value, override the values of all the other internationalization variables. she's the boss, she overrules everybody πŸ‘‘
  • LC_CTYPE β€” determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).
  • LC_MESSAGES β€” determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
  • NLSPATH β€” determine the location of message catalogs for the processing of LC_MESSAGES.

⭐ ASYNCHRONOUS EVENTS ⭐

Default.

translation: nothing special happens here, standard behavior only, moving on πŸ’…


πŸ’€ STDOUT πŸ’€

the fuser utility shall write the process ID for each process using each file given as an operand to standard output in the following format:

"%d", <process_id>

that's the exact format, bestie. %d and the process ID. copy it character for character, don't get creative 😭


πŸ”₯ STDERR πŸ”₯

the fuser utility shall write diagnostic messages to standard error.

the fuser utility also shall write the following to standard error:

  • The pathname of each named file is written followed immediately by a <colon>.
  • For each process ID written to standard output, the character 'c' shall be written to standard error if the process is using the file as its current directory, and the character 'r' shall be written to standard error if the process is using the file as its root directory. Implementations may write other alphabetic characters to indicate other uses of files.
  • When the -u option is specified, characters indicating the use of the file shall be followed immediately by the user name, in parentheses, corresponding to the real user ID of the process. If the user name cannot be resolved from the real user ID of the process, the real user ID of the process shall be written instead of the user name. so worst case you still get something, just a number instead of a name 🫢

when standard output and standard error are directed to the same file, the output shall be interleaved so that the filename appears at the start of each line, followed by the process ID and characters indicating the use of the file. Then, if the -u option is specified, the user name or user ID for each process using that file shall be written.

a <newline> shall be written to standard error after the last output described above for each file operand. one last little line break, as a treat 🌸


πŸŽ€ OUTPUT FILES πŸŽ€

None.

she writes to stdout and stderr and that's it, she's not out here creating files, she's too busy πŸ’…


πŸ¦‹ EXTENDED DESCRIPTION πŸ¦‹

None.

no extended description, no secret bonus chapter, nothing. we're done here.


πŸ’– EXIT STATUS πŸ’–

the following exit values shall be returned:

  • 0 β€” Successful completion. ate and left no crumbs ✨
  • >0 β€” An error occurred. 😭

πŸ™ˆ CONSEQUENCES OF ERRORS πŸ™ˆ

Default.

the following sections are informative. (so like, helpful context, not the legally binding stuff. still useful though, don't skip.)


πŸ’œ APPLICATION USAGE πŸ’œ

None.


🌈 EXAMPLES 🌈

okay bestie, example time, this is the part where it all clicks 🫢

the command:

fuser -fu .

writes to standard output the process IDs of processes that are using the current directory, and writes to standard error an indication of how those processes are using the directory and the user names associated with the processes that are using the current directory.

fuser -c <mount point>

writes to standard output the process IDs of processes that are using any file in the file system which is mounted on <mount point>, and writes to standard error an indication of how those processes are using the files.

fuser <mount point>

writes to standard output the process IDs of processes that are using the file which is named by <mount point>, and writes to standard error an indication of how those processes are using the file.

(spot the difference? -c = whole filesystem, no -c = just that one path. lowkey the most important distinction on this whole page πŸ‘€)

fuser <block device>

writes to standard output the process IDs of processes that are using any file which is on the device named by <block device>, and writes to standard error an indication of how those processes are using the file.

fuser -f <block device>

writes to standard output the process IDs of processes that are using the file <block device> itself, and writes to standard error an indication of how those processes are using the file.

so -f says "just the file, not everything on the device." obsessed with the restraint honestly πŸ’…


🧚 RATIONALE 🧚

the definition of the fuser utility follows existing practice.

that's the whole rationale. she's not reinventing anything, she's just doing what everybody already does. no cap.


⭐ FUTURE DIRECTIONS ⭐

None.


πŸ“ SEE ALSO πŸ“

  • The Base Definitions volume of POSIX.1‐2017, Chapter 8, Environment Variables
  • Section 12.2, Utility Syntax Guidelines

portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.

in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


okay that's the whole page bestie, we made it 🫢 this was brought to you by IEEE/The Open Group, 2017, and the letter f. now go fuser something responsibly, and remember: stdout for the process IDs, stderr for the drama πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from