Fajlovi i njihove karakteristike

Šta je šta od karakteristika nekog fajla (SVE u Linux-u je fajl!!!!!) :
$ ls -l test
-rwxr-xr-x 1 test users 111 Apr 13 13:48 test
Permissions The first column (-rwxr-xr-x in this example) is the file’s permissions
Directories use the execute bit to grant permission to search the directory.
Permissions on symbolic links are always 777. This access applies only to the
link file itself, not to the linked-to file.
The user mask, or umask, determines the default permissions for new files. The umask is the value that is removed from 666 (rw-rw-rw-) permissions when creating new files, or from 777 (rwxrwxrwx) when creating new directories. /etc/profile or ~/.bashrc
Number of links The next column (1 in this example) shows the number of hard links to the file—that is, the number of unique filenames that may be used to access the file.
Username The next column (test in this example) identifies the file’s owner by username.
Group name The file’s group (users in this example) appears next.
File size This example file’s size is quite small—111 bytes.
Time stamp The time stamp (Apr 13 13:48 in this example) identifies the time the file was last modified.
Filename Finally, ls -l shows the file’s name—test in this example.

Linux file type codes :
Normal data file. May be text, an executable program, graphics, compressed data, or just about any other type of data.
d Directory. Disk directories are files, but they contain filenames and pointers to those named files’ data structures.
l Symbolic link. The file contains the name of another file or directory. When Linux accesses the symbolic link, it tries to read the linked-to file.
p Named pipe. A pipe enables two running Linux programs to communicate with each other in a one-way fashion.
s Socket. A socket is similar to a named pipe, but it permits network and bidirectional links.
b Block device. A file that corresponds to a hardware device to and from which data is transferred in blocks of more than one byte. Disk devices (hard disks, floppies, CD-ROMs, and so on) are common block devices.
c Character device. A file that corresponds to a hardware device to and from which data is transferred in units of one byte. Examples include parallel and RS-232 serial port devices.

Modifying a file requires write access to the file, but creating or deleting a file requires write access to the directory in which it resides.

Special permission bits :
Sticky bit – special filesystem flag, ako je setovan nad folderom, korisnik može da izbriše fajl iz datog foldera SAMO ako ima nad njim ili folderom u kome je fajl ima vlasništvo (write dozvola nad folderom nije dovoljna). Vidi se kao slovo “t” pri listanju foldera.
Postavlja se kao #chown 1755 ….. skida se sa 0755 :
# ls -lah /|grep tmp
drwxrwxrwt. 41 root root 52K Feb 13 09:22 tmp
Obično se koristi za /tmp foldere.
SUID bit – set user ID bit. Program koji otvara tako označeni fajl radi sa dozvolama vlasnika datog fajla, a ne sa dozvolama korisnika čiji je program. Ovakvi fajlovi su označeni kao :
rwsr-xr-x root root 55K Feb 14 09:22 proba
Podešava se sa npr 4755.
Slično je sa SGID bitom (rwxr-sr-x). Podešava se sa npr 2755.

Skriveni fajlovi
Većina alata za listanje neće prikazati (sa default svičevima) fajlove čija imena počinju sa tačkom (.).