Unix Help

  1. How do I copy a file?
  2. How do I rename a file?
  3. How do I delete a file?
  4. How do I delete a directory?
  5. How do I check the permissions on a file or directory?
  6. How do I see a listing of hidden files?
  7. I've written a script but how do I make it executable?

How do I copy a file?

in the same directory:

 
username@metlab:~> cp original_file new_file
username@metlab:~>

to another location:

 
username@metlab:~> cp original_file /path/to/destination/new_file
username@metlab:~>

More Info.
How do I rename a file?

 
username@metlab:~> mv original_file new_file_name
username@metlab:~>

More Info.
How do I delete a file?

To remove a file in the current directory:

 
username@metlab:~> rm filename
username@metlab:~>

To remove a file in a location other than the current directory:

 
username@metlab:~> rm /path/to/file/filename
username@metlab:~>

More Info.
How do I delete a directory?

If the directory is empty, the following will work:

 
username@metlab:~>rmdir directory_name
username@metlab:~>

If the directory has files or other directories inside you will need to use the following command. Be very careful with this!!

 
username@metlab:~> rm -r directory_name
username@metlab:~>

More information aboutthe rm command or the rmdir command.
How do I check the permissions on a file or directory?

 
username@metlab:~> ls -l filename

More information about the ls command and the ls command and file permissions.


How do I see a listing of hidden files?

 
username@metlab:~> ls -a

More Info.
I've written a script but how do I make it executable?

 
username@metlab:~> chmod u+x script_name
username@metlab:~>

More Info..
Last modified: Wed Sep 12 15:08:23 GMT 2007
Is Something not working correctly? Please fill out the Meteorology Comment Form to report any problems you may find with the lab computers, equipment or software.