Navigating the Unix File System: A Beginner's Guide To Working With Files And Directories
In the Unix operating system, you can use a variety of commands to
manage files and directories, including creating, copying, moving, and
deleting files and directories.
Here are some common commands for
working with files and directories in Unix:
1. touch
: Creates a new, empty file.
$ touch file.txt
2. cp
: Copies a file.
$ cp file.txt file-copy.txt
3. mv
: Renames or moves a file.
$ mv file.txt file-renamed.txt
$ mv file-renamed.txt /home/user/documents
4. rm
: Deletes a file.
$ rm file-copy.txt
5. mkdir
: Creates a new directory.
$ mkdir project1
6. rmdir
: Deletes an empty directory.
$ rmdir project1
7. ls
: Lists the files and directories in a directory.
$ ls
file1.txt file2.txt file3.txt
8. cd
: Changes the current working directory.
$ cd /home/user/documents
$ pwd
/home/user/documents
9. pwd
: Prints the current working directory.
$ pwd
/home/user/documents
By using these commands, you can easily manage files and directories in the Unix operating system.
Architecture of the Linux file system and folders contained in the root folder:
The Linux file system architecture is a hierarchical structure that consists of several different levels of directories and files. At the top of the hierarchy is the root directory, represented by "/".
The root directory contains all other directories and files on the system and is the starting point for all file paths.
Here are some of the main directories contained in the root directory of a typical Linux operating system:
- /bin: Contains the essential user commands for all users.
- /boot: Contains the boot loader configuration files and the Linux kernel.
- /dev: Contains special files that represent devices such as hard drives and printers.
- /etc: Contains configuration files for the system and applications.
- /home: Contains the home directories for each user.
- /lib: Contains shared library files used by programs and the operating system.
- /media: Mount points for removable media such as CDs and USB drives.
- /mnt: Temporary mount points for file systems.
- /opt: Contains third-party software applications.
- /proc: Contains information about the running system, such as system and process information.
- /root: The home directory for the root user.
- /run: Contains information about running processes.
- /sbin: Contains system-level commands that are typically only executed by the root user.
- /srv: Contains data for services provided by the system.
- /tmp: Contains temporary files.
- /usr: Contains user-related programs, libraries, and documentation.
- /var: Contains variable data such as logs and system backups.
These are the main directories contained in the root directory of a typical Linux operating system, but there may be additional directories and files depending on the distribution and configuration of the system.
Understanding the Linux file system architecture and the purpose of each directory can help you manage and organize your files and directories more effectively.
Reference Books
Here are the books I’ve used as references for writing this article,
please feel free to read them If you don’t want your knowledge to be
limited to this article alone.
Post a Comment