- Views: 1
- Report Article
- Articles
- Writing
- Article Marketing
How to Navigate the Linux Filesystem?
Posted: Sep 13, 2021
Introduction
Linux is an open-source operating system. It is always developed collaboratively. Linux is one of the greatest ecosystems. That is for use from small digital wristwatches to servers and supercomputers.
In this article, we will attempt to become up to speed with the basics of Linux operating system. We can be overwhelmed by the view of controlling and navigating the file system of Linux from the command line, if we do not have much experience working with Linux systems.
Description- Linux put in order files using a hierarchical system.
- Files are kept in directories.
- These directories may as well comprise other directories.
- We will find that there are no drive letters in Linux when compare the Linux filesystem to Windows.
- All files are put in storage in a single root directory.
- We also essential the information about the directory hierarchy well-known as the pathname to find a file in Linux.
- The pathname is self-possessed with a top-level directory, a directory hierarchy, and the filename with the file extension.
- All are divided by a forward slash (/).
This is essential for everyone to know about important special characters before getting into commands. They have special functionality in the Linux filesystem.
- The dot (.) stand for the current directory in the filesystem.
- The dot-dot (..) signifies one level above the current directory.
- The forward slash (/) symbolizes the root of the filesystem.
- Each directory or file in the Linux filesystem is nested under the root / directory.
- The tilde (~) stand for the home directory of the presently logged in user.
DirectoryFiles that the directory contains/Single root directory – file system base/binExecutable files such as Linux commands cat, cp, ls/bootFiles that the boot loaders access during start-up –
including the Linux kernel/devFiles for the different hardware/devices/etc.Initialization scripts and system config files/homeUser directories/libLibrary files which includes driver modules/lost+foundFor lost files/mediaMounting removal media filesystems/mntTemporary directory for mounted filesystems/optFor storing application packages/procInformation on Linux processes/rootRoot user home directory/sbinExecutable files for commands that is used by root user/srvFor services hosted by the system (e.g. FTP, web)/tmpTemporary directory – deleted during system reboot/usrContains subdirectories for program files/varLog filesNavigating the directories
We can use the following ways to navigate in the directories on Linux:
- Using the GUI to find a certain file by going through the folders.
- Using the universal text-based search function.
- By using the command line.
Now we will discuss about significant commands in Linux operating system. These commands are our navigation tools inside the Linux filesystem. We may use the following valuable commands in our terminal to navigate and work in the file system:
CommandsWhat it doesIsList down all the contents of a directorcd /bin/Changes directory and goes to bin dircd ~the tilde (~) sign signifies the user’s home dir – change dir to home directorycd.Means to change directory one level up. For instance, we are currently /home/edulaney/, using the command will take us to /home/mkdirA command used to create directoriespwdShort for present working directory. This command will display the directory where we are currently in.cat/home/edulaney/files/file1.txt
Command used to print all the contents of file1.txt in the screencp /home/ /tmp/Copy contents of /home/ to /tmpmv/home/edulaney/files/file1.txt
/tmp/
Move the file file1.txt to the /tmp/ directory. We can also use this command to move the entire directory to another directoryrm file1.txtDelete the file file1.txt. Take extra precaution in using the rm command, especially when we are logged in as root.find / -name "linux*"The find command is a powerful tool that we can use when searching using the command line. The command now willsearch for any file or directory with a name that starts with linux
File and Directory HandlingNow we’ll demonstrate how to create and manipulate files and directories.
Create a File with touch
- Several commands and programs can create files.
- The basic method of creating a file is with the touch command.
- This would create an empty file using the name and location stated.
- We should first validate that we are in our home directory.
- This is a location where we have consent to save files.
- Then, we may create a file called file1 by typing:
- We can see newly created file if we view the files in our directory:
- We can similarly create multiple files at the same time.
- We may use absolute paths as well.
- For example, if our user account is called demo, we could type:
Create a Directory with mkdir
- The mkdir command permits us to create empty directories.
- For example, to create a directory within our home directory named test, we could type:
- For making a directory within the test directory called example by writing:
- The test directory must previously exist for the above command to work.
- We can use the -p option to tell mkdir that it should create any directories needed to construct a given directory path.
- This permits us to create nested directories in one step.
- We may create a directory structure that appearances like some/other/directories by typing:
- The command would make the some directory initially.
- Then it would create the other directory inside of that.
- Lastly it would create the directories directory within those two directories.
We have presented the basic view of filesystem navigation and manipulation in Linux operating system. The best way to comprehend any concept is by putting it into practice. Therefore, we can further understand better the Linux file system with the help of described commands which are our navigation tools.
For more details visit: https://www.technologiesinindustry4.com/2021/09/how-to-navigate-the-linux-filesystem.html
Mansoor Ahmed Chemical Engineer,Web developer