Day-3 Basic Linux Commands

Day-3 Basic Linux Commands

1. cat 'fileName' -To view what's written in a file.

No alt text provided for this image

2. chmod 777 folderName/fileName -To change the access permissions of files.


No alt text provided for this image

3. history -To check which commands you have run till now.

No alt text provided for this image

4. head -3 'fileName' -To Show only top three fruits from the file.

No alt text provided for this image

 5. tail -3 'fileName'  To Show only bottom three fruits from the file.

No alt text provided for this image

6. diff 'file1' 'file2' -To find the difference between two files.

No alt text provided for this image

7. Sudo  -This command executes only that command with superuser privileges.

No alt text provided for this image

8. Grep  -This command searches for a particular string/ word in a text file. This is similar to “Ctrl+F” but executed via a CLI.

No alt text provided for this image

9. Sort  -This command is used to sort the results of search either alphabetically or numerically. It also sorts files and directories.

No alt text provided for this image

sort -r  -the flag returns the results in reverse order.

sort -f - the flag does case-insensitive sorting.

sort -n  -the flag returns the results as per numerical order.

No alt text provided for this image

10. Chown  -This command is used to change the file Owner or group.

Here, below the ownership of the “Chetan.txt” file got changed to root.

No alt text provided for this image

11. Ping – This command will ping a host and check if it is responding.

No alt text provided for this image

12. Find  -This is used to find files and directories and perform subsequent operations on them. 

In the below command, It will search in the present working directory and its subdirectories, and print the name of the file that have “.txt” file extension.

No alt text provided for this image

13.  ssh user@host – Connect to the host as a user.

14. Ssh-keygen - This command is used to generate a public/private authentication key pair.

This process of authentication allows the user to connect remote server without providing a password.

(This authentication method we will use to authenticate the server with Jenkins while deploying CI/CD pipelines).

No alt text provided for this image

 15. Apt-get - This command is used to install, update, and remove packages, as well as to manage the package repository sources.

Here are some common apt-get commands:

  • apt-get update: This updates the package index files from the package repositories listed in the /etc/apt/sources.list file. This is usually the first command you should run after adding a new repository or package to your system.
  • apt-get upgrade: This installs newer versions of packages that are already installed on the system. It will also remove any packages that are no longer required.
  • apt-get install: This installs one or more packages. For example, to install the nano text editor, you would run apt-get install nano.
  • apt-get remove: This removes one or more packages, but it does not remove the configuration files for the package.
  • apt-get purge: This removes one or more packages and their configuration files.
  • apt-get autoremove: This removes packages that were installed as


16. apt-get  -May be considered as lower-level and "back-end", and support other APT-based tools. 


17. apt  -Is designed for end-users (humans) and its output may be changed between versions.


18. cp 'source' 'destination' -This command used to copy contents/files from one to another

No alt text provided for this image

19. SCP 'source' 'destination' -This command is used to share the files between the local system and to server and vice versa

Thank you! for reading this article.

Happy Learning!

要查看或添加评论,请登录

Deepak Patil的更多文章

社区洞察

其他会员也浏览了