-   Debian (
-   -   Directory/File Listings (

AndeAnderson 02-23-2005 09:20 AM

Directory/File Listings
I am not sure if this is the right place to ask this, but since I have Debian installed I'll ask.

How, or where, do I find a listing of what Directories and Files are used in Debian? Surely there is a default listing somewhere.

What executable files are in Debian? For example, the file "cat" does not appear to exist or I do not know what Directory, or how to get to it, to find it in. Anyway, I can not execute the "cat" command either as root or as a user.

I am, what was called, windows-centric. I am used to being able to do a dir or tree command to find a complete listing of what files are in what directory. Linux does have the "ls" command, but that is only good for the directory you are in. And, since I do not know what directories are available I can not change directories and use the "ls" command. Even then, doing them one at a time, it would be awkward and time consuming.

In Linux, so far, I feel like I am walking around blind. Unable to see what the "Path" is or what files are located where.


dastrike 02-23-2005 09:48 AM

ls can list recursively as well by the -R option to it. Example:

ls -R
One can also use the find command. It can be combined with e.g. grep or find's own -regex option to filter out all unwanted data. Example:

find | grep -i mp3
You can also use the locate command to find files, but the locate command needs it's database being up to date. That is usually updated from a cronjob sometime in the early morning hours but if one doesn't have the computer turned on 24/7, there is a risk that it hasn't run in a long time. To update the locate's database manually, execute updatedb as root. Example of using the locate command:

locate readme.txt

To see what your PATH environment variable contains, execute

echo $PATH
The directories listed there are the ones that typically contain the executables (or symlinks to them or wrapper scripts to them).

Dead Parrot 02-23-2005 12:43 PM

$ su
# apt-get install mc
# exit
$ mc

corfe 02-23-2005 12:54 PM

In general, you'll want to "cd" to different places. To get to the root of all of your files, type "cd /" - that's a FORWARD slash, not a backslash. Then you can ls, and see all your root directories. CD around and look around. As a general rule, debian's regular executable files are located in /usr/bin (for example, mozilla), the ones that are very basic / might be needed when emergency booting / etc. (for example, cat and ls) are located in /bin, and system tools (that can usually only be used by root) are in /sbin.

After you've apt-get install 'ed a package and you want to know what files are sitting on your system from that package, try a "dpkg -L packagename". For example, "dpkg -L coreutils" will show you all the files that the package "coreutils" is using on your system - which is the package that contains the program "cat". If you don't have it, remember you'll want to "apt-get install coreutils" as root, first.

Anyways, all this is to satisfy your curiousity, but if you're still new to linux, you shouldn't need to worry about any of this, and you can just apt-get install things and happily type in the command name at the commandline without worrying about where its files are located / etc.

AndeAnderson 02-23-2005 02:11 PM

New means need to know and learn
In a way you are correct in your statement "Anyways, all this is to satisfy your curiousity, but if you're still new to linux, you shouldn't need to worry about any of this..."

But, when a "standard" command is used and it does not execute then I need to be able to find if it even exists and where it is located to be able to use it. You say "... which is the package that contains the program "cat". If you don't have it, remember you'll want to "apt-get install coreutils" as root, first." The executable "cat" does not work on the Debian distribution I installed. So, I want to first find out where it is supposed to be located and what the path should be for it to work correctly. That way I will learn some of the internal operations of the Debian distro.

I am not sure about this "cat" program anyway. I have used vi and am fairly comfortable with it. I still have my "cheat sheets" from school somewhere and the Unix System V Bible is still applicable.

I am not ready to add any additional ports, programs, or utilities until I have familiarized myself with those already provided in the Debian basic install. The structure of directories and files have a big influence in my ability to learn and be able to use the system effectively.

I first want a solid foundation of the basics before I start getting into the use of advanced commands and GUIs.

Doing a CD look around in individual directories is what I was trying to do and found that to be a very time consuming and sometimes confusing activity.

Where do I find the Basic Default Directories and File listings for this Debian Distribution? There has to be one, if just for a quick reference for the developers to ensure some form of continuity.

Where do I get access to the PATH environment for making corrections?

It is my curiosity which drives me to understand something before I try to use it. I still believe in using the Command Line in Microsoft and have found that even some of the old, but useful, DOS commands will still work even in Win 2k and XP. The hard part is keeping track of them as the upgrades progress.

Dead Parrot 02-23-2005 02:32 PM

man hier
more ~/.bash_profile
more /etc/profile

Or you can use vi instead of more.

I'd suggest you re-install Debian using Debian-Installer release candidate 2 to get a fully working base system with all the necessary goodies:

Dead Parrot 02-23-2005 02:44 PM

Oh, and the mc program I mentioned in my earlier post is GNU Midnight Commander, a friendly file manager that lets you stay close to the command line. I've personally found it very useful when exploring a new system and its file hierarchy. Here's a picture that should give you an idea of what mc looks like:

But if you want to use only the bash commands, then have it your way. ;)

f1dave 02-24-2005 12:59 AM

MC is pretty cool. But there's always combos. If you like your fighting games, you know combos dish out extra damage- and in linux, combining commands with pipes, filters, other commands, etc can yield good results if for example you are trying to find a particular text file.

Of course, combos aren't always easy to learn. :S

All times are GMT -5. The time now is 12:59 PM.