go to  ForumEasy.com   
JavaPro  
 
 
   Home  |  MyForum  |  FAQ  |  Archive    You are not logged in. [Login] or [Register]  
Forum Home » Java Deploying » Create / Delete File on Unix / Linux
Email To Friend  |   Set Alert To This Topic Rewarding Points Availabe: 0 (What's this) New Topic  |   Post Reply
Author Topic: Create / Delete File on Unix / Linux
Unix
member
offline   
 
posts: 7
joined: 10/06/2011
from: Cupertino, CA
  posted on: 10/06/2011 09:22:33 PM    Edit  |   Quote  |   Report 
Create / Delete File on Unix / Linux
The cat command

To create a text file called foo.txt, enter:
$ cat > foo.txt
Hello world!
press CTRL+D to save file

To display file contents, type
$ cat foot.txt


The vi command
$ vi foo.txt
Hello world!
press Esc+:+x+Enter to save file

Note:
  • Usually, on most filesystems, creating a file requires write permission on the parent directory (and execute permission, in order to enter the directory in the first place)
  •  Profile | Reply Points Earned: 0
    Unix
    member
    offline   
     
    posts: 7
    joined: 10/06/2011
    from: Cupertino, CA
      posted on: 10/06/2011 09:24:13 PM    Edit  |   Quote  |   Report 
    The rm command

    rm (short for remove) is a Unix / Linux command which is used to delete files from a filesystem.

    The syntax is as follows:
    rm -f -r {file-name}
    
    where:
    
  • -f: forcibly remove file
  • -r: remove the contents of directories recursively


  • To remove a file called foo.txt, enter:
    $ rm foo.txt

    Note:
  • Usually, on most filesystems, deleting a file requires write permission on the parent directory (and execute permission, in order to enter the directory in the first place)
  •  Profile | Reply Points Earned: 0

     
    Powered by ForumEasy © 2003-2005, All Rights Reserved. | Privacy Policy | Terms of Use
     
    Get your own forum today. It's easy and free.