Sunday, November 10, 2019

File & directory manipulation

1.  cp – copy files and directories
Ø  cp  file1.fileFormat file2.fileFormat -: to copy file1 contents to file2 in same path
Ø  cp  file1.fileFormat /path/file2.fileFormat -: to copy file1 contents to file2 in different path
Ø  cp  file.fileFormat directoryName -: to copy file into a directory in same path
Ø  cp  file.fileFormat /path/directoryName -: to copy file into a directory in different path
Ø  cp -r  directory1Name directory2Name -: to copy directory1 contents to directory2 in same path
Ø  cp -r  directory1Name /path/directory2Name -: to copy directory1 contents to directory2 in different path

2. mv – move files and directories
Ø  mv  file1.fileFormat file2.fileFormat -: to move file1 contents to file2 in same path
Ø  mv  file1.fileFormat /path/file2.fileFormat -: to move file1 contents to file2 in different path
Ø  mv  file.fileFormat directoryName -: to move file into a directory in same path
Ø  mv  file.fileFormat /path/directoryName -: to move file into a directory in different path
Ø  mv  directory1Name directory2Name -: to move directory1 contents to directory2 in same path
Ø  mv  directory1Name /path/directory2Name -: to move directory1 contents to directory2 in different path

3. rm – remove files and directories
Ø  rm filename.fileFormat -: to remove the file
Ø  rm -r directoryName -: to remove the directory

4. find – find files and directories
Ø  find /path -name filename.fileFormat -: to find the file concerning case-sensitive
Ø  find /path -iname filename.fileFormat -: to find the file concerning case-insensitive
Ø  find . -type d -name directoryname  -: to find the directory
Ø  find . -type f -name filename.fileFormat -: to find the file
Ø  find . -type f -name “ *.fileFormat-: to find all files in related file format

No comments:

Post a Comment

fork() - Theory

fork() is used create a new child process. Ø   No arguments Ø   Process ID of the child process Ø   After the execution of fork() command ...