How to manipulate files in Linux


Make a Directory:

$ mkdir dirname
$ mkdir dirname1 dirname2
$ mkdir -p dir1/dir2/dir3

Copy Files:

$ cp file file2

You can also copy multiple files into one directory with a single command:

$ cp file1 file2 file3 dir1

Moving or Renaming Files:

$ mv file file2

To move the file into another directory:

$ mv file dir1

If you want to rename the file to file2 and move it into another directory, you probably already figured out the command:

$ mv file dir1/file2

Deleting Files and Directories:

$ rm file

You can also delete more files at once:

$ rm file1 file2

Leave a Reply

Your email address will not be published. Required fields are marked *