how to delete locked folders/files

146

Solution 1

Launch your file explorer as root using:

gksudo nautilus

This will open your file explorer, and grant it root, so it should be able to view/delete the directory/file.

If you are like me, and don't care about the warnings in this question you can use this instead:

sudo nautilus

Solution 2

Try the following: launch Terminal and enter

sudo rm -rf '/path/to/locked/folder'

And be VERY careful with the path to folder!

Solution 3

Steps:

  1. Open Terminal.
  2. Run command:

    sudo su
    
  3. Command above would ask for your password.
  4. Once the correct password is given, you would give following command.

    chmod a+rwx folder/file 
    

    and go to home and just delete the folder/file.

  5. Exit for root user type exit.

Solution 4

The lock symbol means your user currently have no write permission on the file/folder. To change this:

  1. Check the current owner/group/permissions status by right clicking the file/folder, clicking Properties and then switching to the Permissions tab.
  2. Open a Terminal by hitting Ctrl+Alt+t.
    • If you are the Owner of the file (i.e. the Owner field shows your username): add write permission to the owner by running this command: chmod u+w <path_to_file_folder>
    • If you are not the Owner of the file, but you are in the Group group (i.e. the Group field shows your username or a name of a group to which you belong, e.g. sudo): add write permission to the group by running this command: sudo chmod g+w <path_to_file_folder>
    • If you are not the Owner of the file and you are not in the Group group: add write permission to the others by running this command: sudo chmod o+w <path_to_file_folder>
  3. Run exit

And then just delete the file/folder from Nautilus.

Alternatively:

  1. Open a Terminal by hitting Ctrl+Alt+t.
    • Remove the file/folder as root by running this command: sudo rm -rf <path_to_file_folder>

Solution 5

Here is something , that I found was easier to do instead of opening terminal. Right-Click the file and open properties. Then switch to the permissions tab. Then wherever it says Access: change it from whatever it is to Create And Delete Files. This should remove the lock and then you can delete the file normally.

Share:
146

Related videos on Youtube

s_khan92
Author by

s_khan92

Updated on September 18, 2022

Comments

  • s_khan92
    s_khan92 over 1 year

    I am new to use Beautifulsoup. Actually, I want to get all the links from the page but only which came as result. Here is the example link: Daad1

    Moreover, there are pages and i want to do get all the links also from all the other pages.

    So far i am doing this to get the URL's but its also genearting output with extra text:

       import requests
        from bs4 import BeautifulSoup
    
    
        getpage= requests.get(url)
    
        getpage_soup= BeautifulSoup(getpage.text, 'html.parser')
        url =https://www2.daad.de/deutschland/studienangebote/international-programmes/en/result/?q=&degree%5B%5D=1&fos=&cert=&admReq=&scholarshipLC=&scholarshipSC=&langDeAvailable=&langEnAvailable=&lang%5B%5D=2&cit%5B%5D=&tyi%5B%5D=&ins%5B%5D=&fee=&bgn%5B%5D=&dur%5B%5D=&sort=4&subjects%5B%5D=&limit=10&offset=&display=list&lvlEn%5B%5D=
    
        all_links= getpage_soup.findAll('a')
    
        for link in all_links:
            link = link.get('href')
            print (link)
    

    Desired Output:

    I would like a list of all the URLS ONLY from the search result as well as list of URLs from all the pages in pagination. The help will be appreicated :) I tried to find solution but didnt able to find.

  • user300458
    user300458 about 9 years
    gksudo nautilus (not sudo)
  • Henry
    Henry about 9 years
    sudo works as well, I never understood why people used gksudo, it always caused my more trouble because I needed to install it, as it was not included with my system. And I find it more annoying to have to wait for the window to open, then type in my password, possibly blocking other open windows. I prefer if it just asked for my password in the terminal, it's quicker and less obstructive.
  • user300458
    user300458 about 9 years
  • Henry
    Henry about 9 years
    Edited my answered to include both sudo and gksudo
  • Leonardo
    Leonardo about 9 years
    IT WORKED ONLY WITH GKSUDO
  • Henry
    Henry about 9 years
    It's works for me with sudo
  • David Foerster
    David Foerster over 7 years
    @Zanna: sudo su works on my system and I didn't change the root account or the sudoers configuration in a relevant way. But it's unnecessary because one could just run sudo chmod ... instead.
  • Zanna
    Zanna over 7 years
    @DavidFoerster I thought I had deleted that comment already! but yes indeed it's completely unnecessary
  • David Foerster
    David Foerster over 7 years
    This answer is basically the same as kos' but with less detail and worse practices.
  • Zanna
    Zanna over 7 years
    yeah agree with that too
  • pomsky
    pomsky about 5 years
    Do not use sudo nautilus, see this: askubuntu.com/q/270006/480481
  • s_khan92
    s_khan92 over 4 years
    Thanks alot for such an amazing solution. But still i am unable to get results for pagination.
  • KunduK
    KunduK over 4 years
    @s_khan92 : Can you check properly I think url comes from all pages I have check the last url with last page and its showing correct.Are you sure it is not coming