Knowledgebase: Using Shell (SSH)
What are some ways I can manipulate a file in shell?
Posted by Pacific Host on 04 December 2011 05:12 PM

mv fred wilma
This moves fred to a file named wilma. This is the Unix way of renaming a file.

mv fred flintstones/fred
This moves fred to a file named fred in the subdirectory flintstones. This example could have been written mv fred flintstones/ as well, and the filename fred would have been retained in the new directory.
After executing this command, there will no longer be a fred file in the current directory.

cp
cp fred wilma
This copies fred to a file named wilma.

cp fred flintstones/fred
This copies fred to a file named fred in the subdirectory flintstones.


rm flintstones
This removes a file named flintstones.

rm -rf flintstones
This removes a directory named flintstones. The -r removes the directory, the -f forces it to remove files without asking you before it deletes each one.

(0 vote(s))
Helpful
Not helpful

Comments (0)