Skip to main content

Day 2 Task: Basics Linux command

 Day 2 Task: Basics Linux command







Task: What is the linux command to 

1. Check your present working directory.

2. List all the files or directories including hidden files.

3. Create a nested directory A/B/C/D/E



Ans:-

1. "pwd" is command to check present working directory on linux machine.


2. "ls -la" is command to list all the files or directories including hidden files.

in above command,

"-l" is use for list the files and directories in long list format with extra information and

"a" is use for list all including hidden files and directory in linux machine.


3. To create a nested directory use following command :-


"mkdir -p A/B/C/D/E" 


"-p" stands for "no error if existing, make parent directories as needed"


showing the nested directory in linux machine use "tree" command..



Listing commands

- ls -l --> list the files and directories in long list format with extra information

- ls -a --> list all including hidden files and directory

- ls *.sh``` --> list all the files having .sh extension.

- ls -i ``` --> list the files and directories with index numbers inodes

- ls -d */``` --> list only directories.(we can also specify a pattern)

Directoy commands


pwd --> print work directory. Gives the present working directory.

- cd path_to_directory--> change directory to the provided path

- cd ~  or just  cd  --> change directory to the home directory

-  cd - --> Go to the last working directory.

-  cd..  --> chnage directory to one step back.

-  cd ../..--> Change directory to 2 levels back.

-  mkdir directoryName --> to make a directory in a specific location


Examples:


mkdir newFolder              # make a new folder 'newFolder'


mkdir .NewFolder              # make a hidden directory (also . before a file to make it hidden)


mkdir A B C D                  #make multiple directories at the same time


mkdir /home/user/Mydirectory   # make a new folder in a specific location


mkdir -p  A/B/C/D              # make a nested directory




Comments

Popular posts from this blog

Day 04 — Basic Linux Shell Scripting

Explain in your own words and examples, what is Shell Scripting for DevOps. What is #!/bin/bash? can we write #!/bin/sh as well? Write a Shell Script which prints I will complete #90DaysOofDevOps challenge Write a Shell Script to take user input, input from arguments and print the variables. Write an Example of If else in Shell Scripting by comparing 2 numbers Was it difficult? 1. What is Kernel The kernel is a computer program that is the core of a computer’s operating system, with complete control over everything in the system. 2. What is Shell A shell is special user program which provide an interface to user to use operating system services. Shell accept human readable commands from user and convert them into something which kernel can understand. It is a command language interpreter that execute commands read from input devices such as keyboards or from files. The shell gets started when the user logs in or start the terminal. 3. What is Linux Shell Scripting? A shell script is a

NGINX Web App Deployment for DevOps

  Step 1: Create AWS instance. Step 2: Install NGINX Step 3: Install docker and create a Container for note-app. Step 4: Set up a reverse proxy. Step 5: Copy the code to the root folder. Step 6: Connect the database nginx specification Step 1: Create AWS instance. Log in to the AWS account and create an ec2 server. Nginx is a web server that will serve you static web files. So we require a server. - Create an EC2 instance and name it 'nginx-project-demo'. Also, don't forget to allow HTTP and HTTPS traffic. ( For sake of practice, let's select an Ubuntu machine with t2.micro instance type) Update your server using the command.   sudo apt-get update Step 2: Install NGINX Now install Nginx using the command below. sudo apt install nginx Check the status of nginx. systemctl status nginx Restart the nginx server with root user permission. sudo systemctl restart nginx To check further nginx is successfully installed on your server is to use the server IP and paste it into the