Day 2 Task: Basics Linux command


Task: What is the Linux command to
- Check your present working directory.
However, if you want to check the present working directory in Linux, you can use the pwd
command in the terminal. Just open a terminal window and type pwd
, then press Enter. The terminal will display the current working directory path of your local machine.
List all the files or directories including hidden files.
To list all files and directories, including hidden files, in Linux, you can use the
ls
command with the-a
(or--all
) option. This option displays all entries, including the ones starting with a dot, which indicates hidden files and directories.Open a terminal window and type the following command:
bls -a
This will show a list of all files and directories in the current working directory, including the hidden ones. Each entry will be displayed on a separate line. Hidden files and directories will have names starting with a dot (e.g.,
.hidden_file
or.hidden_directory
). Non-hidden entries will be listed as usual without a dot prefix.Create a nested directory A/B/C/D/E
Create the nested directory structure A/B/C/D/E in Linux using the
mkdir
command. Here's the step-by-step process:Open a terminal window, and follow these commands:
- Create the directories one by one from A to E:
bashCopy codemkdir A
cd A
mkdir B
cd B
mkdir C
cd C
mkdir D
cd D
mkdir E
Sure, I can guide you on how to create the nested directory structure A/B/C/D/E in Linux using the mkdir
command. Here's the step-by-step process:
Open a terminal window, and follow these commands:
- Create the directories one by one from A to E:
bashCopy codemkdir A
cd A
mkdir B
cd B
mkdir C
cd C
mkdir D
cd D
mkdir E
- Now, the nested directory structure A/B/C/D/E has been created.
Alternatively, you can create the whole nested directory structure at once using the -p
(parents) option of the mkdir
command:
mkdir -p A/B/C/D/E
This will create all the necessary directories, even if the parent directories (A, B, C, D) do not exist.
After executing any of the above commands, you will have the nested directory structure A/B/C/D/E in your current working directory.
Subscribe to my newsletter
Read articles from HARDIK PANSANI directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
