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

Bash Scripting

  How to Create Your First Bash Scrip touch hello_world.sh Find the path to your bash shell. where bash is located which bash touch hello.sh ls -al Permission of file #! bin bash #! /bin/bash echo "hello" for execute ./hello.sh Comment # before line of comment it give more information about script ++++++++++++++++++++++++++++++++++++++++++++++ when ever we define a Variable it can store somedata string data any no or any other kind of data 1 System variable 2 Userdefine variable System variable echo $BASH echo $BASH_VERSION echo $HOME echo $HASH_VERSION echo $PWD 2. USERDEFINE VARIABLE name = Mark echo $name echo "this is my $name +++++++++++++++++++++++++ #To take the input from user echo "enter name: " read name echo "entered name $name" ++++++++++++++++++ for multiple name echo "enter name: " read name1 name2 echo "Names: entered $name, $name1, $name2" +++++++++++ to print on same line read -p 'usena...

Devops on AWS

  SDLC Model - Software Development Life Cycle Waterfall Model Agile Model Waterfall Model Disadvantages of Waterfall Model It is difficult to estimate time and cost for each phase of the development process.  Once an application is in the testing stage, it is very difficult to go back and change something that was not well-thought out in the concept stage.  Not a good model for complex and object-oriented projects.  Not suitable for the projects where requirements are at a moderate to high risk of changing. Agile Model Agile development model is also a type of Incremental model. Software is developed in incremental, rapid cycles. This results in small incremental releases with each release building on previous functionality. Each release is thoroughly tested to ensure software quality is maintained. Agile software development method emphasis on iterative, incremental, and evolutionary development. Delay In spite of the Model, still delay? Gap between development tea...

All About Linux

  File System cd / It go to root dir. or main dir. ls -ltr it show pre define folder or dir. shows *Everything in linux is a File* we used audio video in daily life that called file but in linux command is also consider as a file Whereis ls cd /usr/bin ls All file avaible all commands avaible file also present To manage all the data and file linux need a file system Os store and manage data on disk or partitions using a structure called filesystem FileSystem includes files, directories and its related permissions. Fs stores data in hierarchy of directories and files. In Windows  INSIDE THE FOLDER LINUX FILE STRUCTURE Types of file system/ versions 1. ext3 extended 3  2. ext4 3. XFS 4. FAT 5. BTRFS etc.. How to check your linux filesystem? lsblk -f 1. XFS (EXTENTS FILE SYSTEM) XFS is 64bit high performance FS support parallel I/O operations works well with large files <Which file we have to use> its depends on application and user requirments cd/ ----> root dircto...