1 Computer File Organization
Operating Systems
Each computer runs on an operating system, the most important software within a computer. An operating system manages the computer’s memory, processes, other software and hardware. It enables user interaction without understanding the computer’s language. MacOS, Linux, and Microsoft Windows are three of the most popular operating systems.
Key Terms
File: A file is a digital object that stores specific content that is accessible via a computer program or operating system. You are likely familiar with lots of type of files: word processing documents, pictures, movies, and songs are all different types of files.
Folder: A folder is a container that can store many files. For example, all operating systems default to downloading new files into a folder called “Downloads” until a user moves them elsewhere.
Directory: A directory functions like a filing cabinet, storing not only individual files but also folders and sub-folders. Organized hierarchically from left to right, directories manage data across different levels, enabling efficient organization and retrieval.
Unix & Linux History
Unix was created in 1969, by AT&T Bell Laboratories researcher, by the name of Ken Thompson. Thompson quickly realized the complexity of the interface was reminiscent of an operating system in itself. This prompted Thompson to create the early prototype skeleton of the operating system. This new system was later called “Unix”, in the 1970s, these later progressions also used this name with consecutive numbers dictating the version. Another important aspect to note is the incorporation of text processing in “Unix 4th Edition”. This was facilitated by a typesetter, thus setting the foundation for integrated pipe systems that act as a filter. This creation of “pipes” acted as a vital component for sending output commands.
This brings us to the creation of Linux in the early 1990s, which is a distinctly different system to Unix. But it’s undeniable that the roots of these commands originated from the Unix system. Thus, Linux is often deemed a “Unix-like operating system”. The most notable difference between Unix and Linux, is that Linux is just a bridge within the operating system between the computer hardware and software (also known as a “kernel”). This Linux kernel is capable of a complete operating system with the inclusion of Linux distributions. The main advantage of Linux (kernel and distribution) is that the software is multilingual, obtained and used free of cost and is mostly open source.
Linux
Overview
Linux is an open-source operating system with a variety of versions. In VCL (Visual Cognition Lab), we use Ubuntu. Debian, Red Hat, and Mint are other common examples of slightly different Linux systems.
(File, 2021)
Linux supports a variety of distribution platforms, making it adaptable to devices ranging from wireless routers to smartphones. The Linux source code is open, allowing developers to create different versions for different applications. Developers across the world have modified and adapted Linux to create personal, more tailored operating systems.
/home
As Root
The home directory for Linux begins with the command /home/username
- Example:
cd /home/bvcl/Downloads
To determine your specific username, type whoami
into the terminal and your username will appear.
Alternative ways of accessing the home directory is using the cd
command, cd
command with ~
, and lastly cd
command with $HOME
.
Major Directories
/bin
The /bin
directory, which stands for “binary”, includes the basic binaries (i.e., source code) that are vital for the system to perform basic functions. Although most users do not need to do this, to access the contents of the binary directories, one would input the command ls
, (as in “list out”) with /bin
- Example:
ls /bin
/etc
The /etc
directory, which stands for “etcetera”, is used to access all the system configuration files and is where the directories are stored. Hence, the name indicated this directory is for miscellaneous files and items. To access a miscellaneous file, one would input the command /etc/
, with the desired file name or directory name.
-Example: /etc/passwd
←This can be used to access the file that stores information about the user accounts, groups, and passwords on the machine. As you can see, the files in this folder contain sensitive information and should be kept secure.
/opt
The /opt
directory, which stands for “optional”, is used for installing software packages that not not accessible by the package manager provided by Linux distribution. This can be especially helpful when installing third party software. The commands to input to see the /opt
directory would be ls
, and in “list out” with /opt
.
- Example:
ls /opt
/tmp
The /tmp
directory, which stands for “temporary”, is used to store information for the short term or for a short period of time. This is often time used for files that one needs to download an application, thus putting an application installer (something you will not need in the future, when the app is fully installed) in this directory makes sense.
- Example:
/tmp/appinstaller.zip
/usr
The /usr
directory is used to access other libraries, binaries and other documentation. The system files that are in this directory can be shared with other users. The commands to input to see the /usr
directory would be ls
, and in “list out” with /usr
.
Example A:
ls /usr
← This can be used to access files that are under the /usr directory.Example B:
/usr/bin
← This can be used to access other binary files that are not found in the/bin
directory.
/var
The /var
directory, which stands for “variable”, is used to store files that are constantly changing in size. A good example of these types of files are log and spool files. The commands to input to see the /var
directory would be ls
, and in “list out” with /var
.
Example A:
ls /var
← This can be used to access files that are under the/var
directoryExample B:
/var/log
← This can be used to access the system and log files.
Mac
Overivew
Mac is the operating system developed by Apple. Mac was developed on top of an OS similar to UNIX, thus there are many common characteristics between Mac OS and Linux and Unix OS.
/Users
as Root
The home directory for MacOS begins with the command /Users/username
- Example: cd /Users/bvcl/Downloads
- To determine your specific username, type
whoami
into the terminal and your username will appear.
Major Directories
/Applications
This directory is used to download applications that are accessible to all users on the computer.
- Example: In the terminal, type
cd ~/Applications
, then inputls
to see the list of what is in the application directory
~/Library
This directory is used to access the local library folder, and will vary depending on the user. Therefore the files that appear will be more personalized to the user as compared to the system library folder. The only person that can access this library is the specific user.
- Example: In the terminal, type
cd ~/Library
, then inputls
to see what is under said file
/System
This directory is used to access the operating system and other files that are used to run the computer. Some notable sub-files in this folder is the Library, IOS Support, and Applications can be in this folder
- Example: In the terminal, type
cd /System
, then inputls
to see what is under said file
Windows
Overview
Windows is an operating system that was developed by Microsoft in 1985 and it is the most widely used operating system.
(Wikipedia Contributors, 2017)
C:
as Root
The the home Windows directory begins with the command C:\Users\username\
- Example:
cd C:\Users\bvcl\Downloads
Note: Because Windows was not developed on a Unix backbone, versions of Windows before Windows 10 do not have a full terminal.
Major Directories
\Desktop
The desktop directory is used to see all files and folders that are currently on the desktop. To navigate to the Windows directory input command C:\Users\username\
- Example:
cd C:\Users\bvcl\Desktop
/Documents
The Documents directory is used to see all document files. To navigate to the Windows directory input command C:\Users\username\
-Example:cd C:\Users\bvcl\Documents
/Pictures
The Pictures Windows directory begins with the command C:\Users\username\
- Example:
cd C:\Users\bvcl\Pictures
Hierarchical Structure
Every operating system organizes files and directories in a hierarchical structure. The “home directory” or “root” is the default location where the user-specific files and sub-directories are stored. Understanding how directories are structured in different operating systems is key to navigating them effectively.
Files, Folders and Directories
From a overarching perspective one could think of the directories as a big folder. In these directories there are multiple folders, and in each folder there could be multiple sub-folders. As one navigates through the sub-folder they will reach the file, which is the smallest unit. An example of files could be a picture, document, or recording. Overall this is to help the user of the computer stay organized. This also allows the user to find documents in a quick and efficient manner.
Subfolders (File Paths)
As mentioned above, sub-folders are folders inside another folder. This is often used to further categorize a file according to a more specified subject matter than the folder itself. To specify a path in a complex hierarchy, we separate each level with a slash: /
for Linux and Mac, and \
for Windows.
Example A: In Linux:
'/home/bvcl/Documents/Experiments/'
Example B: In Mac:
'/Users/bcvl/Documents/Experiments/'
Example C: In Windows:
'C:\Users\bvcl\Documents\Experiments\'
Further Reading
We recommend the following sources for more information on this topic:
The Unix Shell by Software Carpentry.
Shell from MIT’s “Missing Semester” Course.