Fun with fuser and wisdom of killing Firefox

Who else is using my file?

Ever got curious to know who else would be using a file/socket?

If i invoke tail polling on a file in two different sessions:

$tail -f logs.txt
$tail -f logs.txt

$ps -fu my
my 11449 11322  0 10:14 pts/0    00:00:00 tail -f logs.txt
my 11508 11450  0 10:14 pts/1    00:00:00 tail -f logs.txt

And now i want to see who all are user of the file /home/my/logs.txt:

my@ubuntu:~$ fuser /home/my/logs.txt
/home/my/logs.txt: 11449 11508

Say if you want to disassociate your file from other user, use “fuser” to find the culprit and kill them one-by-one 🙂

my@ubuntu:~$ fuser -k ./logs.txt
./repl-proto-logs.txt: 11449 11508
my@ubuntu:~$ fuser  ./logs.txt

This is very useful command to know about shared files and forceful release it from unwanted access.

(key inputs: Srikanth Samana)

A very crude trick to save Firefox sessions

To save time, i use a crude method of saving all my Firefox tabs. This helps me getting all the opened websites back, when I restart the Firefox after a shutdown.

  • In Windows: go to task manager, kill the Firefox process
  • Linux: Find the PID of Firefox, and send kill -9

simple!

When Firefox restarts, it asks you to “restore” the old session; just say yes!

Advertisements

2 thoughts on “Fun with fuser and wisdom of killing Firefox

    1. yes, it does. If you do that, you save your tabs as en entry in FF history. Next, after restart you have to navigate and open these entries. The trick discussed here keeps only the last browsed tabs for you. And as soon as you start, just press one button of “Restore” 🙂

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s