How to manipulate files by command prompt ?

| | 1 min read

We are no strangers to commands in bash. Bash provides an ample amout of commands to manipulate on files. The main commands that are commonly used are,

  • cp - copy files and directories
  • mv - move or rename files and directories
  • rm - remove files and directories
  • mkdir - create directories

cp is a command used to copy the file in a particular destination to another. Eg.,

cp README.txt /home/zyx/Projects/zyx 

Here, we are trying to copy the file README.txt in the current directory to the folder zyx in the path /home/zyx/Projects/.

mv is a command used to move the file in a particular destination to another. Eg.,

mv README.txt /home/zyx/Projects/zyx 

Here, we are trying to move the file README.txt in the current directory to the folder zyx in the path /home/zyx/Projects/.

rm is a command used to remove the file in a particular destination. Eg.,

rm README.txt 

Here, we are trying to remove the file README.txt in the current directory.

The command mkdir is used to create a folder. Eg.,

mkdir new 

Here we trying to create a new folder in the current directory.

There is so many extensions are used along with these commands, which let us use it in interrative and in a recursive manner.