Trying to delete files in terminal for more space but get "no such file or directory"

Found some files from an old podcast app (Vocal) that I removed. Found them trying out some commands in the terminal (still learning the terminal). Here is the command I used: find . -type f -size +100M -print
I got the following:
./.local/share/vocal/Baseball Tonight with Buster Olney/ESP9640885249.mp3
./.local/share/vocal/Forum Borealis/When_the_Earth_nearly_died.mp3
./.local/share/vocal/Forum Borealis/Hacking_Egregores_1.mp3
./.local/share/vocal/Forum Borealis/Pentagon_s_biggest_secret.mp3
./.local/share/vocal/Forum Borealis/Gnostic_Resurrections_1.mp3
./.local/share/vocal/Forum Borealis/The_Hess_Mess_Enigma_1.mp3
./.local/share/vocal/Forum Borealis/Factions_of_Breakaway_Civilizations_2.mp3
./.local/share/vocal/Forum Borealis/What_you_should_know_about_Vikings.mp3
./.local/share/vocal/Forum Borealis/Operation_Yggdrasil.mp3

There's more but you get the idea. So I decided to try to delete them.
I used this command:
rm ./.local/share/vocal/Forum Borealis/When_the_Earth_nearly_died.mp3

The response:
rm: cannot remove './.local/share/vocal/Forum': No such file or directory
rm: cannot remove 'Borealis/When_the_Earth_nearly_died.mp3': No such file or directory

Not sure what's wrong. Being a former Windows guy I thought all I needed was the command and the path. It seems that it doesn't like that there is a space between "Forum" and "Borealis". That happens to be the name of the podcast that I downloaded and the path that was returned with the find command.
I tried to use the Files gui app to find the path local/share/vocal/ but couldn't find it. I looked everywhere.

I would love to learn how to delete the files and remove the directory for the Vocal app. Even if there is a way to do it thru the GUI I would like to learn how to do it in the terminal.

Thanks

~/.local/share/vocal/Forum Borealis/Operation_Yggdrasil.mp3

Just be careful while using rm command, one mistake and you can wipe the whole place.

1 Like

Try

rm ~/.local/share/vocal/Forum Borealis/When_the_Earth_nearly_died.mp

That's right, you have to be mindful of spaces on the command line as they're used as delimiters between commands and parameters. If you wanted to delete files "a", "b", and "c" you'd type:

rm a b c

The spaces used here implicitly tell the shell that these are all different files to provide to the command rm. To avoid this situation when dealing spaces in filenames, you need to use quotation marks or escape the space character:

rm 'this is a multi-worded file.png'
rm this\ is\ a\ multi-worded\ file.png

You can better see how and why escaping is important when you need to delete files with spaces and quotation marks in the name:

rm 'Pentagon\'s biggest secret'

The syntax highlighting on the forum doesn't work properly in this last example which actually makes it clearer how the computer stops at the second quotation mark, thinking it's the end of the word. But escaping it like this would actually tell it to read it without special meaning. Of course, it would be much simpler to use double quotes in this case, but you get the idea.

So, before getting to your issue make a note about what @Storm said above. If you accidentally delete the wrong file, it's gone for good; there's no undo button.

To delete a single file with spaces:

rm './.local/share/vocal/Forum Borealis/When_the_Earth_nearly_died.mp3'

To delete an entire directory along with it's contents you need to provide the -r flag (for recursive) to the command.

rm -r './.local/share/vocal/Forum Borealis'

Note here that these commands are using relative paths; you can tell because of the leading dot which means "this directory I'm currently on". If you were to navigate usingcd to another directory, say Documents for example, then the system would not be able to find the files to delete.
Once again @Storm pointed out the solution by using ~ instead, which is a placeholder that the shell would replace with your home directory. These commands are equivalent:

rm '~/.local/share/vocal/Forum Borealis/When_the_Earth_nearly_died.mp3'
rm '/home/windswords/.local/share/vocal/Forum Borealis/When_the_Earth_nearly_died.mp3'

Notice that with this approach you are referencing the file using absolute pathing, that is, starting at the very root of the file system so there's not possible ambiguity.
This is not to say that using relative paths is wrong, but something to be aware of.

Another way to get this job done with the find command is using the -delete option:

find . -type f -size +100M -delete

This would delete every match it finds. Again, no undo button here, so be careful. I would only run this once you've confirmed the returned results are correct.
By the way, here you can also replace the . with ~ character to use absolute path and search in your home directory.

Files and directories that start with a period (.) are hidden files. This means that they won't show up by default when you run the command ls; you need to explicitly use the -a flag for them to appear: ls -a.
Likewise, using a file explorer, you need to explicitly tell it to show these files by toggling a setting. I think you can find it inside the hamburger menu -> Preferences. A nice shortcut that you can use is Ctrl+h to toggle the "show hidden files" setting. This works the same in Windows, though the exact name of the setting and the shortcut might be different.

In this case, the directory that is hidden is ~/.local.

1 Like

I don't know if it is a safety mechanism or not but a few months ago I wanted to delete some elements in a different distribution. This required me to go into the sub-folders and delete there contents before I could delete there containers, before moving back up the chain to remove the primary directory. I had been using rmdir, but this only works on directories that have no content, but you can circumvent this:

One command you should never use is rm -rf. This will wipe your entire system. In the early days of Zorin forum when I was a moderator, I had to delete a malicious post which contained the command with the false advice it would "speed up your system". I believe it was the same actors who spread false information about a fellow moderator having died because he had been absent for some time. I was able to act fast and delete the post. I can remember working late into the night spending hours on stopforumspam.com checking usernames and ip addresses of spammers requesting to join the forum.

2 Likes

I missed seeing that; glad you were paying attention better than me.

2 Likes

I didn't even notice you posted right before me! I'm not exactly what you'd call a fast "typer" and tend to take my time to write replies, so I often miss previous replies when this happens :sweat_smile:

1 Like

There are Dot's at the Beginning and before the ''local''. So, these are hidden Files. when You want to make them visible in Files, you have to activate the Option ''Show Hidden Files'':

1 Like

Thanks to everyone who helped! I was able to delete the largest files (> 100 Mb). Getting better at terminal :grinning:

I then went into files and followed Ponce-De-Leon's advice and turned on hidden files. Wow. I went into the folder for the podcast app (Vocal) - there were hundreds of downloaded podcasts, most less than a 100 Mb, but when you add them up - I just reclaimed over 20 Gb of space back!

See, I like to listen to podcasts, but on my phone I stream them. I never download them unless I know I will be somewhere without a cell connection. The Vocal app was never clear that it was downloading everything I was subscribed to. I assumed it worked like the podcast app on my phone. Also it was buggy - I had to start it 2 or even 3 times to get it working and it could blow up in the middle of a podcast, that's why I uninstalled it.

If anyone knows of a reliable podcast app that doesn't blow up and will allow me to stream off the internet let me know. I also tried Kasts, that was buggy too.

Thanks

3 Likes

Just to add the keyboard shortcut for show/hide hidden files is Ctrl+ H.

1 Like

I can't really recommend anything as I listen to them over the browser. Most of them have their own website that I just bookmark or have a dedicated YT channel where they upload the audio. However, I use VLC as my media player which has some basic support for podcasts. It's not the best UI/UX ever but it can handle them.

On the phone, I use AntennaPod.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.