DEV Community

Chirag Kumar
Chirag Kumar

Posted on

Basic CLI Commands

➔ Open Terminal

➔ Know where you are? Present Working Directory

Image description

➔ Create a directory/folder in your home directory

Image description

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

Image description

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

Image description

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

Image description

➔ Reconfirm your location in your system

Image description

Absolute path and Relative path

What is a path?

A path is a unique location of 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 specifying the location of a file or directory from the root directory(/). In other words, an absolute path is a complete path from the start of the actual filesystem from the / directory.

Some examples of the absolute path:
/home/imran/linux-practices/
/var/ftp/pub
/etc/samba.smb.conf
/boot/grub/grub.conf

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

What is the relative path?

The relative path is a path related to the present working directory(pwd). Suppose I am located in /home/imran and I want to change the directory to /home/imran/linux-practices. I can use the relative path concept to change the directory to Linux practices and also the devopsdir directory.

Image description

If you see all these paths did not start with / directory.
➔ Creating directories in devopsdir directory with absolute and relative path.

Image description

➔ Copying files into directory.

Image description

➔ Copying directories from one location to another.

Image description

➔ Moving files from one location to another.

Image description
Image description

➔ Removing files and directories.

Image description

Top comments (0)