Tiny Deathstars of Foulness

A quick and easy way to figure out what process ID and user has a file open is to use fuser. While fuser sounds like maybe some rad command that could emit lasers out of your laptop and fuse together your frenemies, it’s not. It also can’t put that bowl you just dropped off the table that you made when you were 6 and your mother still gushes over. I told you not to use it as an ash try she’ll say. Also, I don’t use it often as lsof can do such things as well. But sometimes you don’t wanna’ wait that long. So let’s look at using fuser. First, run fuser along with a file: fuser /Library/Logs/CrashPlan/backup_files.log.0 The output will just be the filename back to you, followed by a : then a pid. Now try it with the -u option: fuser -u /Library/Logs/CrashPlan/backup_files.log.0 Holy crap, a user is included. Again, it’s not something I use a lot but it’s easy to parse so if you’re running a lot of lsof or other calls, then you can save a little expense within your scripts here.

January 14th, 2014

Posted In: Mac OS X, Mac OS X Server, Ubuntu, Unix

Tags: , , , ,