Need help finding Device files in Ubuntu 12.04 LTS

manicmike

Distinguished
Mar 3, 2012
202
0
18,710
I am taking a Linux/UNIX class, and the teacher offers to let us dial in to the school's LInux/UNIX server using PuTTY. Unfortunately, it never works right when I do it, so I installed VMWare and Ubuntu 12.04 LTS on it.

The problem I'm having is his question, "Show the permissions of at least 5 of the files that reside in the directory where the device files reside. Copy/paste the command and results into a NotePad file and upload it to the Assignment. (3 points)". I know how to show the permissions once I find them, but that is proving to be the hard part!

The book tells me that they are located in the "dev" directory, but from my home directory typing "ls -la<enter>" does not list a directory named "dev".

Can anyone help me out? I've been through about 15 directories now and I'm not having any luck...

Thanks,
Mike
 
Solution
Indeed. As Mark pointed out, the files you are looking for in /dev

If you are familiar with Windows file systems, think of Linux like this:

In Windows 7:

My Documents is in "C:\Users\Username\My Documents" and the lowest level of the file system would be C:\ or the "C drive".

In Ubuntu Linux:

Documents is in "/home/username/Documents" and the lowest level of the file system is / or "root".

/ in Linux is called "root", because it is the lowest level or "root" of the file system. Unlike Windows though, Linux conveniently attaches all hardware to the file system somewhere. In the case of hard drives, it "mounts" their partitions anywhere the user would like, such as /mnt/Windows7 . In this example, Window7 is an empty directory or...
The dev file you are looking for is at root. In terminal, from your home directory type " cd /dev " without the quotes. Your terminal should then read yourhomedir /dev - run you ls command there and you will find all the tty files etc.

Mark
 

1991ATServerTower

Distinguished
May 6, 2013
141
4
18,715
Indeed. As Mark pointed out, the files you are looking for in /dev

If you are familiar with Windows file systems, think of Linux like this:

In Windows 7:

My Documents is in "C:\Users\Username\My Documents" and the lowest level of the file system would be C:\ or the "C drive".

In Ubuntu Linux:

Documents is in "/home/username/Documents" and the lowest level of the file system is / or "root".

/ in Linux is called "root", because it is the lowest level or "root" of the file system. Unlike Windows though, Linux conveniently attaches all hardware to the file system somewhere. In the case of hard drives, it "mounts" their partitions anywhere the user would like, such as /mnt/Windows7 . In this example, Window7 is an empty directory or "folder" and the system mounts the partition containing what Windows would call C:\ on top the Window7 directory.

Also handy is the fact that mounting over top of stuff is non-destructive. So if you happened to have copied a file into the Windows7 folder, but had forgotten to mount the "C drive" first, and then you mounted it without deleting the file, the file would still be there, you just wouldn't be able to see or use it until you unmounted the "C drive".

With that in mind, /dev is the directory or "folder" where the system stores files that allow your computer to use the hardware devices that make up your computer.

/dev/cdrom is the cdrom drive.
/dev/sda is the first serial ata hard drive.
/dev/sda1 is the first partition on the first serial ata hard drive.
/dev/video0 could be used for a webcam, etc.

And so on.

One of my favorite uses of the Linux file system is making "loopback file systems". Sounds complicated, but it's really simple and super handy.

A loopack file system is just a blank file (which you can name anything you like) that has been formated with a file system, as though it was a hard drive. That's it. To use it all a person needs to do is use the losetup command to assign the file to the the device /dev/loop0 and then use the mount command to mount /dev/loop0.

This is sort of like a zip file and it comes with the similar benifit of being able to copy and paste or transfer a whole whack of files inside of just one file, which is ALWAYS faster than moving the same number of files one at time. In a practical sense, one can use as loopback file system on a computer that has a small Linux partition and a large Windows partition. Just make a loopback file on the Windows partition, format the file, and mount it to /usr/home/myspace or where ever you needed more space.

Anyhow, that's a little more about the Linux file system and what /dev is used for.
 
Solution