Hi, friends, we are back with the third part of Linux basics. This part will be on the management of files & directories in the Linux. Here are some linux directory commands for you.
Linux Directory Commands for Managing Directories
In the previous part we started with some Linux file commands. These commands work in Linux for the creation of directories & files. If you are reading this article before reading the previous one, then you must read all the previous one so that you can learn the basic part first.
As in the last part we tried creating some files & directories in the desired location in the disk. Now we will be learning Linux directory commands that will be helping you in file management. So without wasting any time start with copy command. Also Read : Basics of Linux for the purpose of Ethical hacking
Using Cp command you ca copy a file from one location to other. This can be done by a given syntax. You can use Cp command in the syntax given at last. You can use Cp command in two variations. CpFilename with SourceDestination of file Cpfilename Destination of file
In the first line, we used Cp command by providing filename, source of file & destination of file.
In the next line no destination is given as the file is in the current directory.
This command creates one copy in the destination & the file in source directory remains unchanged.
There is no command to rename a file, Mv command is used by the user to move files as well as rename them. mv /root/file-name
This command will move the file in root folder & file will be deleted from the previous location.
One more use of this command is to rename the files. This can be done by putting original name & new name in it. As given below. mv filename newname
In the command I have not used any directory name. This is because we have moved the file filename from the current directory to the current directory. But now the name is changed to newname. Now the file filename is deleted.
This command is used to view the contents of a file. Cat is short form of concatenate. Concatenate means to join two things together. What you have to do it use ls-l command to list all the files of the current directory. Now you can use cat command followed by the filename. cat filename.
This command will show file content on the screen very fast until it reaches end of file. You can scroll to see the contents of the file. More Command
There are two command that works like cat command but open the file as per the screen size. It will show the next line of file when you press the key. When you will press enter then the next line of the file will be shown. If you press spacebar then it will scroll one page through the screen. more filename Less command
This is same as more command but there are less functions in this command. The search capability of less command is more than more command. less filename
After this command the file will be shown to you on the screen. Now you can search any string in the file by using /string-name in the file. This feature will let you prefer less command over more command.
Ifconfig Command (Networking Command)
This is the first networking command we are discussing here. This will display the details of your network & computer. ifconfig.
After this command will be entered. This will show you the details like IP address, netmask, broadcast address, interfaces, MAC address of my interface, etc. Also Read : Basics of Linux for the purpose of Ethical hacking Part 2
That’s all for the Linux directory commands. In the next part we will be discussing about the networking command.
If you have any questions for these commands, please let me know. Like our Facebook Pagefor more information. Thank you.