DevOps(Day-2) Linux

 

Linux - Wikipedia

It is an operating system first released on September 17, 1991, by Linus Torvalds. It comes from the family of Unix operating system which is a black terminal screen that provides excellent security.

  1. Check your present working directory.

    The command used to check the directory you are currently at is "pwd".

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

    "ls" - It is the command used to list the files in the present directory.

There are multiple extensions that can be used along with ls command such as:-

-a :- It displays all the hidden files in the directory.

-l :- It gives a long listing of files.

-R :- gives a recursive listing, including the contents of all subdirectories and their subdirectories and so on.

-t :- lists the files in order of the time when they were last modified (newest first) rather than in alphabetical order.

-r :- lists the files in the reverse of the order.

-i :- displays all the files with their index numbers.

  1. "ls *.sh":- It displays all the files ending with .sh present in the present directory.

    "ls -d */":- It displays all the directories in the directory you are currently at.

  2. Commands to navigate and create directories.

    "cd <path_of_the_directory>" :- This command navigates the user to the specified directory.

    "cd .." :- This command changes the directory to previous directory from the directory you are currently at.

    "cd ../.." :- This command changes the directory to two previous directories up from the directory you are currently at.

    "cd ~" :- This navigates to home directory.

    "cd 'Dir name with space' or cd Dir\ name\ with\ space" :- Slash or '' is used for the directories with spaces.

"mkdir <desired_directory_name>" :- This will create a directory.

"mkdir .<Newfolder>" :- This will create a new hidden directory with name Newfolder.

"mkdir A B C D E" :- This will create multiple directories.

"mkdir -p A/B/C/D/E" :- This will create nested directories.

"rmdir <dir_name>" :- This will delete the directory.

"rm -r <dir_name>" :- This will delete all the files and directories inside dir_name directory recurrsively.

"mkdir -m 700 <newdir>" :- This will set the permission while creating the directory.

Comments

Popular posts from this blog

DevOps (Day-1) Introduction

DevOps(Day-3) - File Management in Linux