Basic CLI Commands

➔ 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 li…


This content originally appeared on DEV Community and was authored by Chirag Kumar

➔ 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


This content originally appeared on DEV Community and was authored by Chirag Kumar


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Basic CLI Commands." Chirag Kumar | Sciencx - Sunday August 4, 2024, https://www.scien.cx/2024/08/04/basic-cli-commands/
HARVARD
Chirag Kumar | Sciencx Sunday August 4, 2024 » Basic CLI Commands., viewed ,<https://www.scien.cx/2024/08/04/basic-cli-commands/>
VANCOUVER
Chirag Kumar | Sciencx - » Basic CLI Commands. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/04/basic-cli-commands/
CHICAGO
" » Basic CLI Commands." Chirag Kumar | Sciencx - Accessed . https://www.scien.cx/2024/08/04/basic-cli-commands/
IEEE
" » Basic CLI Commands." Chirag Kumar | Sciencx [Online]. Available: https://www.scien.cx/2024/08/04/basic-cli-commands/. [Accessed: ]
rf:citation
» Basic CLI Commands | Chirag Kumar | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.