Find the answer to your Linux question:
Results 1 to 2 of 2
I'm trying to understand redirection and clobbering within this: [julius@station julius]$ touch file1 [julius@station julius]$ ls file1 [julius@station julius]$ ls > file2 [julius@station julius]$ ls file1 file2 [julius@station julius]$ cat ...
  1. #1
    Just Joined!
    Join Date
    May 2008
    Posts
    9

    Noob question

    I'm trying to understand redirection and clobbering within this:

    [julius@station julius]$ touch file1
    [julius@station julius]$ ls
    file1
    [julius@station julius]$ ls > file2
    [julius@station julius]$ ls
    file1 file2
    [julius@station julius]$ cat file2
    file1 file2

    When the command "ls > file2" is used, I'm assuming:
    This copies the contents of file1 in to file2, although file2 retains its name, while also preserving the original copy file1. Is this correct?

    Also, I'm confused as how either file1 or file2 are showing following "cat file2".

    Thanks,
    Chris

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Duplicate threads/posts are not allowed. Its against Forum Rules. Please continue here only.
    Thread Locked.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...