Now remaining are just 2 operations .Copying and moving files and folders.You can copy a file using cp command
Inorder to copy a file to a destination we can use cp command.usage is listed as follows:
cp <file to copy > <destination>
Moving Files or folders with mv command.
mv <source file > <destination>
Now you can handle your files and folders easily.
Wednesday, 29 February 2012
Thursday, 23 February 2012
Handling Folders and Files with Linux command Line[part2]
In the previous part I just explained 3 commands that will help you to navigate through files and folders in your system.In this section let us discuss how to perform some actions like create, rename, remove folders using command line.
Creating a folder using the command:
The command used to create a folder is mkdir .Open up the terminal and type :
mkdir myfolder
A new folder named myfolder will be there in your home directory.You can make folders anywhere in your system.But you must mention the directory address for your folder with folder name otherwise the folder will be created in the current directory.
Eg: to make a folder in the directory /tmp use the following command.
mkdir /tmp/myfolder
Extra note : Normally your system will not display any message after creation of the folder. If you add the parameter -v to the mkdir command you will get a message after the creation of the folder (eg: mkdir myfolder -v)
Removing a file or folder
The Linux kernel consider folder and file as same .You can remove any file or folder using the command rm .
the usage of the command is rm [option] <file> .
Here are the important options you might use.
-f (forcefully removes file with no prompting)
-v (Explains what is being done)
-r (Removes files recursively in a directory.It is used when the folder contains subfolders.)
I just mentioned the syntax above. But you need just a single command to remove a folder that is
rm -rf /tmp/myfolder
here '-rf' is the option with the command which says that files will be removed recursively and forcefully. And /tmp/myfolder will be the folder we want to delete.
Creating a folder using the command:
The command used to create a folder is mkdir .Open up the terminal and type :
mkdir myfolder
A new folder named myfolder will be there in your home directory.You can make folders anywhere in your system.But you must mention the directory address for your folder with folder name otherwise the folder will be created in the current directory.
Eg: to make a folder in the directory /tmp use the following command.
mkdir /tmp/myfolder
Extra note : Normally your system will not display any message after creation of the folder. If you add the parameter -v to the mkdir command you will get a message after the creation of the folder (eg: mkdir myfolder -v)
Removing a file or folder
The Linux kernel consider folder and file as same .You can remove any file or folder using the command rm .
the usage of the command is rm [option] <file> .
Here are the important options you might use.
-f (forcefully removes file with no prompting)
-v (Explains what is being done)
-r (Removes files recursively in a directory.It is used when the folder contains subfolders.)
I just mentioned the syntax above. But you need just a single command to remove a folder that is
rm -rf /tmp/myfolder
here '-rf' is the option with the command which says that files will be removed recursively and forcefully. And /tmp/myfolder will be the folder we want to delete.
Labels:
Basics,
Terminal,
Terminal Dictionary
Wednesday, 8 February 2012
Handling Folders and Files with Linux command Line[part1]
As
we know Linux command Line is the powerful tool for a user. First of all let us discuss about 3 basic commands which helps you to manage files and folders.
- pwd
- ls
- cd
pwd
:
This command prints the
present working directory. That is if you want to know actual
location where you are standing in your terminal section ,just type
pwd . It makes your navigation better.
ls :
The
ls command is used to list the files and folders in the current
directory .It is similar to the 'dir' command in Windows. It is
important to mention about some parameters those are used along with
ls to make this mapping efficient .
1.
ls -a
The
above command will list all the files and folders including the
hidden
files.
2. ls -r
This
command will list the contents in reverse order.
3. ls *.txt
This
will list all the files of type .txt .You can change the extension
say .jpeg
for picture type files.
cd
:
The simple command which is used to navigate to another directory
expanded as change directory. The syntax is cd <directory>
eg:
cd /usr/bin will move the current directory to /usr/bin.
Note : You can navigate to
the previous directory by the command 'cd ..'
Subscribe to:
Posts (Atom)