Directory is a file
Hardly surprising, every OS would have the concept of directory
or folder
of some short, which is a recursive structure existed for the purpose of storing more directories or files. This has some interesting implications: each directory has two special files named .
and ..
, where the single dot refers to the current directory itself, the double-dot means the parent of the current directory.
So, what’s the maximum allowed depth of sub directories in different OS? I will leave that to you to find out.
A summary of system directories
In a typical Linux/Unix system, you can normally see the following directories:
Linux file system
I will list out a few commonly used directories for your reference:
/
=> the root of all file system/bin
=> binary, it is where the essential tools live/dev
=> device, because everything in Linux system is represented by a file, including hardware, any newly mounted hardware devices will be listed here/etc
=> configuration files for the system/home
=> all system users’ files/lib
=> library, essential system libraries used by programs in/bin
/proc
=> process, files that contain information of current system processes/root
=> root user’s home directory, the name of the root user is “root”, and has access to everything on the system/sbin
=> system binaries, essential system administrator tools/tmp
=> temporary files, typically get cleared after reboot/usr
=> universal system resources, files such icons, programs used by desktop or users/boot
=> boot files, file used by kernel to boot the machine/opt
=> optional, some optional program live/var
=> variable data files, logs, temporary files for the system, caches, backups are stored here
Every directory listed here, except “home”, requires administrator privilege to access. For normal system user, it has access and normally only operates under its own directory under “home”.
Hidden files
Files, begin with “.” in the name, are hidden files. Most of the hidden files contain configurations, such as “.bash_history”, it contains a list of command used.
Useful commands
The true potential of Linux/Unix system being a productivity boost can be unleashed with an effecient use of commands.
Navigation:
List directory content:
Make a file:
Make a directory:
Make a directory tree:
Copy files and directories:
Move/rename files and directories:
Remove files and directories:
Important: because rm
removes the file permanently, think twice before removing it. Alternatively, use a softer approach with option -i
, or create an alias for rm
to it moves files to a trash bin, and clean it afterwards.
By now, you should be good to go explore the fascinating Linxu/Unix system for yourselves.