What is a lock file, and how do I unlock it?

What is a lock file?

File locking is a mechanism that restricts access to a computer file. For example, applications will often create a temporary file while it is open to prevent others from editing the same file. These temporary files are usually deleted when you exit your program. However, if a program crashes unexpectedly or is improperly closed, the lock files can remain and prevent you from opening the program again.

These files may have the same name but start with a dot or hash, or have an extra suffix like .lck at the end, depending on which software you were running.

Cadence lock files are particularly notorious for not deleting properly after a crash.

How do I unlock it?

Follow these steps to delete all of the lock files manually:

Through the command line:

  1. Navigate to your working directory in the terminal using cd
  2. Run ls -latr to show directory listing in long format
  3. Sort by timestamp and reverse so latest files are at the top
  4. Run rm filename to remove each lock file
  5.  Some software may also leave lock files in your home directory, so you should repeat step 2-4 in your home directory

Through the file explorer:

  1. Navigate to your working directory in the file explorer
  2. Sort the folder so latest files are at the top
  3. Delete all files that start with a dot or hash, or end in a .lck extension
  4. Check all subdirectories to make sure every lock file is gone

How do I prevent lock files from being created?

Although application crashes can't always be prevented, the best way to make sure you don't inadvertently leave a lock file is to save and exit the program properly, so the temporary lock files are automatically removed.

Print Article


Article ID: 5060
Mon 5/3/21 4:37 PM
Mon 5/17/21 1:16 PM