As a Linux user you must master Linux terminal. You should be able to handle files and directories through shell.It is fast and quick than using a GUI application for file handling. In this tutorial we are going to see how we can use a shell to manage folders. I have divided this tutorial in to some small topics . So you can learn them all quickly.
1) How to know current directory.
As the first step we need to know how we get the name of current working directory. Actually it is not the name. It's full path related to root directory.
It's so simple. Just type. pwd. Yes you are correct. It's a acronym for print working directory. In no time you can see Linux shell prints out what you wanted.
2) Getting a list of files in current directory.
This is a simple but powerful command. We can use ls command for getting a list of files those are located inside of current directory.
3) Creating a new directory.
Now we are going to make a new fresh directory. Yes new directory will be located in our current working directory. For this purpose we use mkdir command. It is similar to MD command in windows.
4) Deleting a directory
When deleting a directory there are two modes. First one is
rm -r [directory_name]
Second one is
rm -rf [directory name]
In first mode you will prompted for every file inside the folder. But in second method we have used a additional character called f .That means we have forced to remove all files. So no warnings and directory get deleted.
7) Go to a different directory.
This command is same as windows.
By using a CD command we can go to different directory.
4) Copy or move a directory
For copy a directory to a different location we use cp command.
cp -r new /temp
To move a directory we use same syntax with the command mv.
mv -r /new /temp
5) Renaming a directory
The command we use to rename a directory is same as moving directory.we can do it like this.
mv /usr/test /usr/test2