Linux essentials commands for File and Directory Manipulation in hindi

Опубликовано: 13 Май 2026
на канале: techessay
153
4

cd ..
This takes us to the /usr/share/locale/en directory.
A shortcut that you saw earlier that will always take you back to your home directory is to use cd without providing a directory:
cd
pwd
/home/demo
To learn more about how to use these three commands, you can check out our guide on exploring the Linux filesystem.
We will open the /etc/services file, which is a configuration file that contains service information that the system knows about:
Create a Directory with “mkdir”
Similar to the touch command, the mkdir command allows us to create empty directories.
For instance, to create a directory within our home directory called test, we could type:
cd
mkdir test
We can make a directory within the test directory called example by typing:
mkdir test/example
For the above command to work, the test directory must already exist. To tell mkdir that it should create any directories necessary to construct a given directory path, you can use the -p option. This allows you to create nested directories in one step. We can create a directory structure that looks like some/other/directories by typing:
mkdir -p some/other/directories
The command will make the some directory first, then it will create the other directory inside of that. Finally it will create the directories directory within those two directories.
Moving and Renaming Files and Directories with “mv”
We can move a file to a new location using the mv command. For instance, we can move file1 into the test directory by typing:
mv file1 test
For this command, we give all of the items that we wish to move, with the location to move them at the end. We can move that file back to our home directory by using the special dot reference to refer to our current directory. We should make sure we’re in our home directory, and then execute the command:
cd
mv test/file1 .
Copying Files and Directories with “cp”
With the mv command, we could move or rename a file or directory, but we could not duplicate it. The cp command can make a new copy of an existing item.
For instance, we can copy file3 to a new file called file4:
cp file3 file4
Unlike a mv operation, after which file3 would no longer exist, we now have both file3 and file4.
This stands for “recursive”, as it copies the directory, plus all of the directory’s contents. This option is necessary with directories, regardless of whether the directory is empty.
For instance, to copy the some directory structure to a new structure called again, we could type:
cp -r some again
rm file4
Currently, we know how to manipulate files as objects, but we have not learned how to actually edit them and add content to them.
nano