Day3: Leaning mostly used Linux Commands in DevOps

Pradyumna Das
4 min readJan 25, 2023

--

This is the Day 3. I hope you have read all my previous blogs on DevOps. In an earlier blog, we discussed DevOps and Linux basics structure and commands. Today will learn about Linux commands which are mostly used in DevOps.

  1. Root Permission
  • sudo -This command executes with superuser privileges.
  • sudo -i :- This command will switch to root user
  • sudo su :- This command will activate the root permission to the user.

2. Commands about users

  • whoami :- This command is to check which user is logged in.
  • id :- This command will show the details about the user
  • who :- This command will show which user is logged in with some detail
  • w :- This command will show all logged-in user details.

3. System information

  • uname :- This command will show the kernel name
  • uname -r :- show the Karnal version
  • uname -a :- show the kernel details
  • hostname :- This is the command to show the hostname of the server
  • date :- This is the command to show the date and time zone of the server

4. Network Information

  • ip a :- This command will show all network adapters that are connected to the virtual machine.
  • nmtui :- It is a text-based user interface that allows users to manage network connections.
  • ping :- It is used to test the reachability of a host on the network.

5. History

  • history :- It shows their previously executed commands
  • history 10 :- It will display the last 10 commands
  • !number :- It will display of executed command from history by its number
Example of !numbers
!42 # execute command number 45 from the command history
!-6 # execute command number 3 before the current command
!ls # execute the most recent command that starts with 'ls'

6. File and Directory

  • touch :- create a file
  • mkdir :- create directory
  • rm :- remove file
  • rmdir :- remove directory
  • rm -r :- remove the directory recursively

7. Cat

  • cat :- Thi command is used to display the content of the text file.
  • cat -b :- This is used to add line numbers to non-blank lines
  • cat -n :- This is used to add line numbers to all lines.
  • cat -s :- This is used to squeeze lines into one line

8. Grep

  • grep :- It returns results for the matching string option.
  • grep -i :- It returns the case-sensitive strings
  • grep -n :- It prints the matching string along with their line numbers
  • grep -v :- It returns the lines not matching the search string
  • grep -c :- It returns the number of lines in which the results matched search string

9. User and Groups

  • which :- This command is used to know the location of the command.
  • useradd :- Add user in server
  • userdel :- Delete user from the server
  • There are some commands which contain user and group information. /etc/passwd, /etc/group and /etc/shadow
  • useradd, usermod, userdel, and passed commands used to manage users.
  • groupadd and groupdel commands are used to manage groups.
  • change command used to configure and view the password expiration settings for the user.

10. File System Permission

This is the file system permission of Linux. Accordingly, we will give permission to the files and directory.

  • ls -l :- to check the file permission details
  • ls -ld :- show the permission in details
  • chmod :- Using this command will change the file and directory permission

See the first pic of the file permission. After giving the 765 we got the same permission.

Stay tuned for the next Blog.

Connect with me:

LinkedIn: https://www.linkedin.com/in/pradyumna11/

--

--

Pradyumna Das

Engineer who loves writing on DevOps, Linux, and IT Support