Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
First make sure that no other programs are using them (close the ones that are). Then try to delete. If your are sure nothings using the files, go to /var/lock, and delete the lock file for the file you want to delete.
Edit: use 'lsof' to list open files.
You wrote . . .
you have to change the permissions of these files using chmod or you delete this files as root ;-)
1. How do you change permissions? Step by step please.
2. How do you delete files as root? I know how to become the su.
You wrote . .
First make sure that no other programs are using them (close the ones that are). Then try to delete. If your are sure nothings using the files, go to /var/lock, and delete the lock file for the file you want to delete.
Edit: use 'lsof' to list open files.
1. What do you mean "go to /var/lock"?
2. How do I delete the file when I get there?
1. How do you change permissions? Step by step please.
2. How do you delete files as root? I know how to become the su.
3. What do you mean "go to /var/lock"?
4. How do I delete the file when I get there?
Answers:
1) To change the permissions, use "chmod" from the root (su) prompt.
2) "rm /directory/where/file/is/filename.ext
3) "cd /var/lock"
4) "rm filename" (This assumes you're in the folder/directory where the file is)
But I think you just want to do the following:
1) Get to a prompt
2) su yourself
3) "cd /whereever/the/file/is"
4) "rm filename.ext"
As root, you can pretty much do anything you want. The commands you want to look into are "chmod" (which changes read/write permissions), "chown" (which changes the owner of the file), "rm" (which deletes files/directories), and "cd" (change directory) :-D
You can always "man COMMAND" to see the help file, or google it to see what people wrote online. "chmod" settings can be a bit tricky at first....Here's a web link to help you out (http://wsabstract.com/script/script2/chmodcal.shtml)
And of course you could just be lazy and ask in a forum over here. ;-)
Okay - from the top. Here are step-by-step examples.
I do not know any of the names of your file - use a pretend one - /path/to/problemfile
1. change permissions on protected file
Code:
su -
<enter the password>
# change the permissions
chmod 777 /path/to/problemfile
Now you can delete the file - if it isn't locked
2. use lsof
Code:
su -
<enter the password>
lsof /path/to/problemfile
# if nobody is using the file delete it
rm -f /path/to/problemfile
/var/lock is a file.
It has all the names of locked files and what process has those files locked.
-- Based on your responses I hope this is your home machine. If it's a box at work, you should get a LOT of training before somebody gives you su access.
Less known thing about UNIX is that locks are voluntary. Programs may or may not respect the locks set on files. FOr that reason, You can edit, copy, remove, rename, move a file if you have permissions to do so. If you really want to delete that file than use rm -f for forcing the remove.
Less known thing about UNIX is that locks are voluntary. Programs may or may not respect the locks set on files. FOr that reason, You can edit, copy, remove, rename, move a file if you have permissions to do so. If you really want to delete that file than use rm -f for forcing the remove.
Check the date on threads before posting! This thread was started in 2004 and was only revived by carlo.santos' advertising (which has now been reported).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.