Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Dir Ownership?

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
Carlosinfl
Posts: 889
Joined: 2005-02-05 06:11
Location: Orlando, FL

Dir Ownership?

#1 Post by Carlosinfl »

I was looking at my directories in my user dir /home/carlos & noticed that 2 directories have "root" next to it but I don't know why? I think I may have made those directories as root.

Code: Select all

carlos@stricom:~$ ls -l
total 24
drwxr-xr-x  2 carlos carlos 4096 2005-10-14 18:49 drivers
drwxr-xr-x  3 carlos root 4096 2005-10-20 17:37 files
drwxr-xr-x  4 carlos root   4096 2005-10-19 11:38 movies
drwxr-xr-x  3 carlos root   4096 2005-10-19 10:38 music
drwxr-xr-x  7 carlos carlos 4096 2005-10-19 14:21 pics
drwxr-xr-x  5 carlos carlos 4096 2005-10-21 07:33 software
Can someone tell me why the above shows root and how I can change this? to read "carlos" like the rest? I tried "chown carlos /home/carlos/files" and that did not work.

Thanks for any help.

Demetrius
Posts: 49
Joined: 2005-09-15 17:20

#2 Post by Demetrius »

The syntax for chown is chown owner:group. So to change both owner and group you'd use chown carlos:carlos files. To change only the owner you'd use the command you used. To change only the group you'd use chown :carlos files.

Carlosinfl
Posts: 889
Joined: 2005-02-05 06:11
Location: Orlando, FL

#3 Post by Carlosinfl »

Thanks...Just out of curiosity, what is the 4096 between the group and date created?

Code: Select all

stricom:~# chown carlos:carlos /home/carlos/*
stricom:~# cd /home/carlos/
stricom:/home/carlos# ls -l
total 24
drwxr-xr-x  2 carlos carlos 4096 2005-10-14 18:49 drivers
drwxr-xr-x  3 carlos carlos 4096 2005-10-20 17:37 files
drwxr-xr-x  4 carlos carlos 4096 2005-10-19 11:38 movies
drwxr-xr-x  3 carlos carlos 4096 2005-10-19 10:38 music
drwxr-xr-x  7 carlos carlos 4096 2005-10-19 14:21 pics
drwxr-xr-x  5 carlos carlos 4096 2005-10-21 07:33 software
stricom:/home/carlos#

Demetrius
Posts: 49
Joined: 2005-09-15 17:20

#4 Post by Demetrius »

The size, in bytes. If you want a more easily readable output for that number, use ls -lh.

Carlosinfl
Posts: 889
Joined: 2005-02-05 06:11
Location: Orlando, FL

#5 Post by Carlosinfl »

That makes no sense to me if that ls -l shows size in only bytes.

Some of those dir's are empty and some have GB's of data in them. How can they all show 4096 bytes? I will check the ls -lh command.

Demetrius
Posts: 49
Joined: 2005-09-15 17:20

#6 Post by Demetrius »

Everything in unix is treated as a file. The listing from ls will tell you how much space the directory file takes up, not its contents. A folder will fill a block of space on your hard drive (every file, regardless of how small, will fill at least one block). If your folders show a size of 4096 bytes, or 4kb, that would indicate that your hard drive is formatted with blocks that are 4kb in size.

If you want to see how much space the contents of a folder take up you need to use the du command. See its manpage for details.

Jeroen
Debian Developer, Site Admin
Debian Developer, Site Admin
Posts: 483
Joined: 2004-04-06 18:19
Location: Utrecht, NL
Contact:

#7 Post by Jeroen »

Particularly, the directory is a sort of 'file' in which there is a list of file names and a number (inode) pointing to the file (or directory, or ...) to which it corresponds: it is an index of what's contained in that directory, it is not the full directory itself.

Post Reply