Directories

A directory is a special file that contains a list of file names one level below.

As a special case, current directory "." And parent directory ".. "Is also written in the directory as a list of file names.

File-related information such as permissions, owner users, owner groups, file size, modification date and time is managed by a mechanism called inode.

Since the inode number corresponding to the file name is written in the directory, you can also get the information.

List of file names written in the directory

You can use the ls command to get a list of the files in the directory.

Note that the term file list here includes regular files and directories.

ls

This is a sample output result of the ls command. foo.txt and bar.png are regular files. test is a directory.

foo.txt
test
bar.png

You can use the "-a" option to view all files, including hidden files.

ls -a
..
..
.bashrc
foo.txt
test
bar.png

Display detailed information including file information

You can use the "-a" option of the ls command to display detailed information, including file information.

ls -a

This is a sample output of "ls -a".

-rw-rw-r-- 1  kimoto kimoto 0    Dec 25 08:41 test.pl
drwxrwxr-x 41 kimoto kimoto 4096 Dec 20 16:53 labo
drwxr-xr-x 2  kimoto kimoto 4096 Apr 5  20:19 lib

Associated Information