INTRODUCTION TO LINUX
What is LINUX?
Just like Windows, iOS, and Mac OS, Linux is an operating system. Linux is a powerful and versatile operating system known for its command- line interface, which allows users to perform a wide range of tasks efficiently,
An operating system is software that manages all the hardware resources associated with your desktop or laptop. To put it simply, the operating system manages the communication between your software and your hardware. Without the operating system (OS), the software wouldn’t function.
One of the fundamental operations in Linux is managing directories, which involves tasks like checking you present working directory, listing files and directories (including the hidden ones) and creating the nested directories.
So here we will be exploring the few Linux command which you need to know in this journey.
1.Checking your present working directory: - First we need to know what present working directory is, so present working directory is the directory in which your terminal or shell session is currently located. To check your present working directory, you can use pwd command.
pwd- print work directory. Gives the present working directory.
pwd command will display path of the current directory.
2. Listing Files and Directories: - To list all the files and directories in the current directory, including the hidden files (those which start with ‘.’(dot)), you can use the ls command with the -a flag. You will get the list of all the files and directories in the current location.
ls -a
The -a flag instruct the ls command to show the hidden files. You will get the list of all the files and directories in the current location.
3. Creating a Nested Directory
Creating a nested directory structure in LINUX is easy and quite straightforward. You can use mkdir command to make one or more directories, including the nested directories.
Suppose we need to create a directory structure like “a/b/c/d/e”, then we can use the -p option with mkdir command, which ensures that parent directories are created if they don’t exist.
In the terminal, we can execute the following command.
mkdir -p a/b/c/d/e
The above command will create the directory structure a/b/c/d/e also it will create any missing parent directories along the way.
领英推荐
LISTING COMMANDS
ls option_flag arguments – list the sub directories and files available in the present directory.
Examples: -
1.?????? ls -l a list files and directory in long list format with extra information.
2.?????? ls -a a list all the hidden files and directory.
3.?????? ls *.sh a list all the files having .sh extension.
4.?????? ls -i a list files and directory with index number in order.
5.?????? ls -d */ a list only directories (we can also specify a pattern)
DIRECTORY COMMANDS
1.?????? pwd – print work directory. Gives the present working directory.
2.?????? cd path_to_directory – change directory to the provided path.
3.?????? cd – change directory to the home directory.
4.?????? cd.. – change directory to one step back.
5.?????? cd../.. – change directory to 2 levels back.
6.?????? mkdir directory_Name – to make directory in a specific location.
7.?????? mkdir .New_folder – make a hidden directory (also dot(‘.’) before a file make it hidden)