This content originally appeared on DEV Community and was authored by Chirag Kumar
➔ Open Terminal
➔ Know where you are? Present Working Directory
➔ Create a directory/folder in your home directory
➔ Change your current working directory to linux-practices(Go to linux-practices folder).
➔ Create some more directories and list them with “ls” command.
➔ Create some empty files with “touch” command and list them.
➔ Reconfirm your location in your system
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.
If you see all these paths did not start with / directory.
➔ Creating directories in devopsdir directory with absolute and relative path.
➔ Copying files into directory.
➔ Copying directories from one location to another.
➔ Moving files from one location to another.
➔ Removing files and directories.
This content originally appeared on DEV Community and was authored by Chirag Kumar
Chirag Kumar | Sciencx (2024-08-04T19:15:04+00:00) Basic CLI Commands. Retrieved from https://www.scien.cx/2024/08/04/basic-cli-commands/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.