the "find" command in terminal has gotten blind?

BigBadBeef

Active Member
Joined
Sep 23, 2021
Messages
458
Reaction score
241
Credits
4,131
Screenshot from 2022-12-25 17-27-02.png


In most cases I just use the desktop environment to find a file on my hard drive, but this time I wanted to check how its done in the terminal. I have already confirmed the file's existence in a subfolder on this path. Why won't the search command find it?

Btw, I know exactly where the file is, its in a subfolder in the directory I'm using. What I want to achieve is to first find the file then "cd" to the folder its located in by using the terminal.
 


You need to add the path.
Code:
find /home/bigbadbeef -name filename
find . -name filename
 
Screenshot from 2022-12-25 17-59-06.png


Lovely!

Now, is there a way to cd to that folder without using copy/paste with the mouse? As you can see, the path to that particular executable is a bit... convoluted, one could easily make a typo!
 
Now, is there a way to cd to that folder without using copy/paste with the mouse?

Not quite... What you do is cd into the parent directory.

Then type "cd" and then type the first few letters of directory you want to enter and press the tab button on your keyboard. Tab will try to autocomplete, but it has some limitations.

Like, if I wanted to go to my Downloads directory, I could type 'cd Dow' and then press the tab button.

I can't just type 'cd Do' and press tab, well I can and it will tell me what matches, because there's also "Documents". To do this with the Documents directory, I'd type 'cd Doc' and then press the tab button.
 
Not quite... What you do is cd into the parent directory.

Then type "cd" and then type the first few letters of directory you want to enter and press the tab button on your keyboard. Tab will try to autocomplete, but it has some limitations.

Like, if I wanted to go to my Downloads directory, I could type 'cd Dow' and then press the tab button.

I can't just type 'cd Do' and press tab, well I can and it will tell me what matches, because there's also "Documents". To do this with the Documents directory, I'd type 'cd Doc' and then press the tab button.
Is autocomplete universal in Debian Terminal? I am asking because I am assembling a guide on how to run a Mono-based game using mesa_glthread. The best way to make a universal guide for something Linux is through a terminal since people's desktop experiences can differ.
 
Is autocomplete universal in Debian Terminal?

As far as I know, yes...

You can even autocomplete sub-directories.

Let's say I have ~/Downloads/foobar - so...

cd Dow <tab>
foo <tab> (or just the f if there are no other directories sharing the first letter)

So on and so on...

And, as far as I know, it's universal across all Linux distros.
 
You could also type cd (name of directory) press enter and than type ls (that's the small letter L) and you will get a list of everything in that directory. See the screenshot attached:-
 

Attachments

  • Wallpapers.png
    Wallpapers.png
    26.4 KB · Views: 140
Yup, adding the full path always helps.
If you direct your attention to the second screenshot I provided, the path in that case is a jumbled mess of letter and numbers. As KGIII put it, tabbing would be the way to go with autocomplete.

What I don't understand is why was the folder created with such a ridiculous name.... I just pulled a flatpack...
 
If you direct your attention to the second screenshot I provided, the path in that case is a jumbled mess of letter and numbers. As KGIII put it, tabbing would be the way to go with autocomplete.

What I don't understand is why was the folder created with such a ridiculous name.... I just pulled a flatpack..
The extension name at the end of that long name is .exe

I checked my Software Center to make sure I wasn't loosing it-
 

Attachments

  • VintageStory.png
    VintageStory.png
    113.2 KB · Views: 135
The extension name at the end of that long name is .exe

I checked my Software Center to make sure I wasn't loosing it-
Its okay, don't worry about it. The fact that its an .exe is not in dispute here. I am making a guide to run it under custom parameters in the terminal. The topic at hand is my only hurdle to overcome.
However if you're into voxel games, you should try it, but a fair warning, its pretty sadistic. Sweet and fluffy on the outside but cruel and unforgiving on the inside.
 
Is autocomplete universal in Debian Terminal?

It applies across all 80 of my stable of distros, covering four Families - Debian, RPM, Arch, and Gentoo.

Cheers

Wiz
 
type ls (that's the small letter L) and you will get a list of everything in that directory
The "ls" command will show the non-hidden files. To get "everything", "ls -a" will show hidden files as well which are preceded by a dot.
 
It applies across all 80 of my stable of distros, covering four Families - Debian, RPM, Arch, and Gentoo.

Cheers

Wiz
Just curious, how many of those have the option where you, in the desktop environment, can just right click within that folder and choose to open the terminal where it will already automatically point towards that folder?
 
Long story short: I have eight different Debian 11 desktop machines. Each one has a different desktop manager, which was chosen from the tasksel menu during installation. I opened a file manager window on each Debian desktop, and right-clicked a folder in the window. Here is what I found:

"Open in Terminal"
GNOME, GNOME Flashback, Cinnamon, LXQt, LXDE

"Open Terminal Here" (same as above, but different wording)
KDE Plasma, Xfce

The "open in terminal" feature did not exist on one Debian desktop manager:
Debian MATE (see NOTES, below)

Cinnamon also included "Open as root" in their right-click menu. None of the others had it.

Drag and Drop:
All of the Debian desktops support drag and drop to the terminal window except LXDE. If you open a terminal window and then drag a folder to the terminal window, it will type in the path to that folder in the terminal window. It works with any command, but a good use would be to type "cd " and drag the folder to the terminal window.

NOTES:
As stated above, the default installation of Debian with the MATE desktop manager does NOT have an "open in terminal" menu.
-> The default installation of Ubuntu MATE (an officially supported version of Ubuntu) has "Open in Terminal". I do not know why. I have some guesses. Perhaps you do too.
 
Its enough to know that all the beginner distros have this option as I'm putting together the guide for a Linux beginner. I just don't have the prespective to know how all the distros work since I don't distro hop.
 
Off the top of my head:
Bash:
 cd $(dirname $(find ./ -type f -iname "vintagestory.exe") )
Or perhaps:
Bash:
find ./ -type f -iname "vintagestory.exe" -exec cd $(dirname {} ) \;

I’m nowhere near my PC to test those, but hopefully one of them will work!!

** Edit - BTW: Those commands are only going to work properly (if they even work at all) if you know for certain that there’s only going to be one result. **
 
Last edited:
Just curious, how many of those have the option where you, in the desktop environment, can just right click within that folder and choose to open the terminal where it will already automatically point towards that folder?

If you think I am going to go through 80 of them to find out ... dream on ;)

On
I have eight different Debian 11 desktop machines.

and

The "open in terminal" feature did not exist on one Debian desktop manager:
Debian MATE (see NOTES, below)

So eight into 80 goes 10, so, Beef, I may have 10 that don't. Guessing.

Cinnamon also included "Open as root" in their right-click menu. None of the others had it.

MATE always has it (amongst mine), Xfce usually, and GNOME has it after you install a package called

nautilus-admin

Nautilus is the name for GNOME's FM (file manager) usually known as Files.

KDE's Dolphin FM had it, then removed it, then brought it back, and then removed it again. There is often an extension or two for Dolphin that say they can enable it, but quite often they do not work.

Wiz
 
Yeah, but can we universally say that anyone who has installed a distro, where by the consensus of the community, is called a beginner distro, has some form of option where you can right click and are able to open a terminal there?
 

Staff online


Latest posts

Top