What are some ways I can manipulate a file in shell?

mv

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

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 Users Found This Useful
Was this answer helpful?

Related Articles

How do I get SSH access enabled?

If SSH access is not enabled, please open a support ticket and we will activate it for you.

What are some basic Linux shell commands?

filename.txt Same as ls �alR, outputs the results to a filels *.html Lists all files ending with...

How do I change file permissions via SSH?

Using the CHMOD command:The letters u (for user), g (for group), and o (for other) are used with...

What is Telnet/SSH and do you allow it?

For security purposes, we do not enable Telnet at all and we only enable SSH access by request....

What is SCP / SFTP?

SCP and SFTP are both part of OpenSSH, the secure shell server we run. Do note that you cannot...