Learn Linux Series part- 2

Learn Linux Series part- 2

This is the second part of "Linux Series of DevOps". You can find first part here .

Basic Commands

➔ Open Terminal

➔ Know where you are? Present Working Directory

Screenshot from 2022-08-07 12-47-12.png

➔ Create a directory/folder in your home directory.

Screenshot from 2022-08-07 12-48-00.png

➔ Change your current working directory to linux-practices(Go to linux-practices folder).

Screenshot from 2022-08-07 12-48-38.png

➔ Create some more directories and list them with 'ls' command.

Screenshot from 2022-08-07 12-48-53.png

➔ Create some empty files with touch command and list them.

Screenshot from 2022-08-07 12-49-20.png

Absolute path and Relative path

What is a path?

A path is a unique location to a file or a folder in a file system of an OS. A path to a file is a combination of / and alpha-numeric characters.

What is an absolute path?

An absolute path is defined as the specifying the location of a file or directory from the root directory(/). In other words we can say absolute path is a complete path from start of actual filesystem from / directory. Some examples of absolute path:

- /home/imran/linux-practices/ 
- /var/ftp/pub
- /etc/sam ba.smb.conf
- /boot/grub/grub.conf

If you see all these paths started from / directory which is a root directory for every Linux/Unix machines.

What is the relative path?

Relative path is defined as path related to the present working directory(pwd). Suppose I am located in /home/imran and I want to change directory to /home/imran/linux-practices. I can use relative path concept to change directory to linux-practices.

➔ We use cp command for copying directories from one location to another.

➔ Moving files from one location to another. Screenshot from 2022-08-07 12-51-23.png

➔ Removing files and directories. Screenshot from 2022-08-07 12-53-20.png


➔ Install vim editor according to your operating system (centos or ubuntu). Here, I use centos.

lunux 2blog 3pic.png

➔ Open up a file in vim editor

Screenshot from 2022-08-07 14-32-50.png

➔ Hit i to enter into insert mode

lunux 2blog 5pic.png

=> type few lines => hit Esc

lunux 2blog 6pic.png

=> type :wq

lunux 2blog 7pic.png

=> Enter.

➔ Read file with cat command.

Screenshot from 2022-08-07 14-32-18.png

VI Visual display editor

VIM Visual display editor improved

This is command mode editor for files. Other editors in Linux are emacs, gedit , vi editor is most popular

It has 3 modes:

1 Command Mode

2 Insert mode (edit mode)

3 Extended command mode

Command Mode:

Command mode means that you can use keyboard keys to navigate, delete, copy, paste, and do a number of other tasks—except entering text.

Insert Mode:

In INSERT mode, you type text.

Extended Mode:

In extended mode, We do advanced features, such as save and quit, search and replace, and customization options.

Note: When you open the vim editor, it will be in the command mode by default.

Screenshot from 2022-08-07 13-43-10.png

Screenshot from 2022-08-07 13-43-37.png

Screenshot from 2022-08-07 13-43-48.png


Screenshot from 2022-08-07 13-44-15.png

Symbolic links

Symbolic links are like desktop shortcuts we use in windows.

Create a soft link for /var/log directory in our current working directory.

lunux 2blog 8pic.png

Thanks for reading. I would love to connect with you all on Twitter .

Did you find this article valuable?

Support WeMakeDevs by becoming a sponsor. Any amount is appreciated!