~backup - Ubuntu

This is a discussion on ~backup - Ubuntu ; This is probably a really stupid question, but it is one of those things you either know or you don't know. In my root directory (as root - witch I have enabled) I have a file: ~backup (that is tilde_mark ...

+ Reply to Thread
Results 1 to 17 of 17

Thread: ~backup

  1. ~backup

    This is probably a really stupid question, but it is one of those things
    you either know or you don't know.

    In my root directory (as root - witch I have enabled) I have a file:
    ~backup (that is tilde_mark backup). I can see it when I ls or ls -l. ls -
    l does not show it as a link or anything unusual, and root has rw on it.

    Yet, if I try to read, open or delete it I get:

    root@somebox:/# cat ~backup
    cat: /var/backups: No such file or directory

    It seems to be pointing somewhere that is gone? It is not shown as a
    link, am I missing something a five year old would know here?

  2. Re: ~backup

    On Mon, 16 Jun 2008 08:09:27 +0000, A J Hawke wrote:

    > This is probably a really stupid question, but it is one of those things
    > you either know or you don't know.
    >
    > In my root directory (as root - witch I have enabled) I have a file:
    > ~backup (that is tilde_mark backup). I can see it when I ls or ls -l. ls -
    > l does not show it as a link or anything unusual, and root has rw on it.
    >
    > Yet, if I try to read, open or delete it I get:
    >
    > root@somebox:/# cat ~backup
    > cat: /var/backups: No such file or directory
    >
    > It seems to be pointing somewhere that is gone? It is not shown as a
    > link, am I missing something a five year old would know here?


    trevor@leoben:~$ ls -l ~*
    ls: cannot access ~*: No such file or directory
    trevor@leoben:~$ cat ~backup
    cat: /var/backups: Is a directory

    Seems to be a shortcut to /var/backups but it's not listed in my system.

    --
    Q: Want to lower petrol prices?
    A: Easy, just boycott BP & Esso



  3. Re: ~backup

    * Trevor Best :
    > On Mon, 16 Jun 2008 08:09:27 +0000, A J Hawke wrote:
    >
    >> This is probably a really stupid question, but it is one of those things
    >> you either know or you don't know.
    >>
    >> In my root directory (as root - witch I have enabled) I have a file:
    >> ~backup (that is tilde_mark backup). I can see it when I ls or ls -l. ls -
    >> l does not show it as a link or anything unusual, and root has rw on it.
    >>
    >> Yet, if I try to read, open or delete it I get:
    >>
    >> root@somebox:/# cat ~backup
    >> cat: /var/backups: No such file or directory
    >>
    >> It seems to be pointing somewhere that is gone? It is not shown as a
    >> link, am I missing something a five year old would know here?

    >
    > trevor@leoben:~$ ls -l ~*
    > ls: cannot access ~*: No such file or directory
    > trevor@leoben:~$ cat ~backup
    > cat: /var/backups: Is a directory
    >
    > Seems to be a shortcut to /var/backups but it's not listed in my system.


    It's the shell expanding '~backup' to '/var/backups'. Most Bourne-like
    shells expand '~user' to the home directory of 'user'. Looking in my
    own '/etc/passwd' file, I find that user backup has a home directory of
    '/var/backups'.

    --
    James Michael Fultz
    Remove this part when replying ^^^^^^^^

  4. Re: ~backup

    On 2008-06-16, James Michael Fultz wrote:
    > * Trevor Best :
    >> On Mon, 16 Jun 2008 08:09:27 +0000, A J Hawke wrote:
    >>
    >>> This is probably a really stupid question, but it is one of those things
    >>> you either know or you don't know.
    >>>
    >>> In my root directory (as root - witch I have enabled) I have a file:
    >>> ~backup (that is tilde_mark backup). I can see it when I ls or ls -l. ls -
    >>> l does not show it as a link or anything unusual, and root has rw on it.
    >>>
    >>> Yet, if I try to read, open or delete it I get:
    >>>
    >>> root@somebox:/# cat ~backup
    >>> cat: /var/backups: No such file or directory
    >>>
    >>> It seems to be pointing somewhere that is gone? It is not shown as a
    >>> link, am I missing something a five year old would know here?

    >>
    >> trevor@leoben:~$ ls -l ~*
    >> ls: cannot access ~*: No such file or directory
    >> trevor@leoben:~$ cat ~backup
    >> cat: /var/backups: Is a directory
    >>
    >> Seems to be a shortcut to /var/backups but it's not listed in my system.

    >
    > It's the shell expanding '~backup' to '/var/backups'. Most Bourne-like
    > shells expand '~user' to the home directory of 'user'. Looking in my
    > own '/etc/passwd' file, I find that user backup has a home directory of
    > '/var/backups'.
    >


    (In the directory where ~backup resides

    ls -l ./~backup

    To remove it:

    rm ./~backup

    or:

    rm -i ./~backup # if you're scared.

    --


  5. Re: ~backup

    On Tue, 17 Jun 2008 06:54:18 +0200, Jim Cochrane wrote:

    > On 2008-06-16, James Michael Fultz wrote:
    >> * Trevor Best :
    >>> On Mon, 16 Jun 2008 08:09:27 +0000, A J Hawke wrote:
    >>>
    >>>> This is probably a really stupid question, but it is one of those
    >>>> things you either know or you don't know.
    >>>>
    >>>> In my root directory (as root - witch I have enabled) I have a file:
    >>>> ~backup (that is tilde_mark backup). I can see it when I ls or ls -l.
    >>>> ls - l does not show it as a link or anything unusual, and root has
    >>>> rw on it.
    >>>>
    >>>> Yet, if I try to read, open or delete it I get:
    >>>>
    >>>> root@somebox:/# cat ~backup
    >>>> cat: /var/backups: No such file or directory
    >>>>
    >>>> It seems to be pointing somewhere that is gone? It is not shown as a
    >>>> link, am I missing something a five year old would know here?
    >>>
    >>> trevor@leoben:~$ ls -l ~*
    >>> ls: cannot access ~*: No such file or directory trevor@leoben:~$ cat
    >>> ~backup
    >>> cat: /var/backups: Is a directory
    >>>
    >>> Seems to be a shortcut to /var/backups but it's not listed in my
    >>> system.

    >>
    >> It's the shell expanding '~backup' to '/var/backups'. Most Bourne-like
    >> shells expand '~user' to the home directory of 'user'. Looking in my
    >> own '/etc/passwd' file, I find that user backup has a home directory of
    >> '/var/backups'.
    >>
    >>

    > (In the directory where ~backup resides
    >
    > ls -l ./~backup
    >
    > To remove it:
    >
    > rm ./~backup
    >
    > or:
    >
    > rm -i ./~backup # if you're scared.


    Brilliant, thanks.
    Just so I can make a note of it, what does the ./ symbolise?

  6. Re: ~backup

    On Tue, 17 Jun 2008 07:00:58 +0000, A J Hawke wrote:

    > Brilliant, thanks.
    > Just so I can make a note of it, what does the ./ symbolise?


    Current directory.

    --
    Q: Want to lower petrol prices?
    A: Easy, just boycott BP & Esso



  7. Re: ~backup

    On Tue, 17 Jun 2008 08:14:16 +0100, Trevor Best wrote:

    > On Tue, 17 Jun 2008 07:00:58 +0000, A J Hawke wrote:
    >
    >> Brilliant, thanks.
    >> Just so I can make a note of it, what does the ./ symbolise?

    >
    > Current directory.


    So what we are saying to rm is;
    'Delete this belligerent file found in ./ and ignore where it is
    pointing.' ?

    What I don't get is how it can be pointing to another location, like a
    link, but ls -l shows it as a file and not a link. That is confusing me.

  8. Re: ~backup

    * A J Hawke :
    > On Tue, 17 Jun 2008 08:14:16 +0100, Trevor Best wrote:
    >
    >> On Tue, 17 Jun 2008 07:00:58 +0000, A J Hawke wrote:
    >>
    >>> Brilliant, thanks.
    >>> Just so I can make a note of it, what does the ./ symbolise?

    >>
    >> Current directory.

    >
    > So what we are saying to rm is;
    > 'Delete this belligerent file found in ./ and ignore where it is
    > pointing.' ?


    The shell expands '~' only if its the first character of the argument.

    > What I don't get is how it can be pointing to another location, like a
    > link, but ls -l shows it as a file and not a link. That is confusing me.


    There's no redirection occurring at the filesystem level. It's your
    shell expanding '~backup' to home directory of user backup. You can
    also prevent expansion by quoting as others have pointed out in other
    messages.

    $ ls -ld \~backup
    $ ls -ld "~backup"
    $ ls -ld '~backup"

    --
    James Michael Fultz
    Remove this part when replying ^^^^^^^^

  9. Re: ~backup

    On Tue, 17 Jun 2008 13:03:59 -0500, James Michael Fultz wrote:

    > * A J Hawke :
    >> On Tue, 17 Jun 2008 08:14:16 +0100, Trevor Best wrote:
    >>
    >>> On Tue, 17 Jun 2008 07:00:58 +0000, A J Hawke wrote:
    >>>
    >>>> Brilliant, thanks.
    >>>> Just so I can make a note of it, what does the ./ symbolise?
    >>>
    >>> Current directory.

    >>
    >> So what we are saying to rm is;
    >> 'Delete this belligerent file found in ./ and ignore where it is
    >> pointing.' ?

    >
    > The shell expands '~' only if its the first character of the argument.
    >
    >> What I don't get is how it can be pointing to another location, like a
    >> link, but ls -l shows it as a file and not a link. That is confusing
    >> me.

    >
    > There's no redirection occurring at the filesystem level. It's your
    > shell expanding '~backup' to home directory of user backup. You can
    > also prevent expansion by quoting as others have pointed out in other
    > messages.
    >
    > $ ls -ld \~backup
    > $ ls -ld "~backup"
    > $ ls -ld '~backup"


    Brilliant! Thank you James.

  10. Re: ~backup

    On Tue, 17 Jun 2008 09:37:23 +0000, A J Hawke wrote:

    > On Tue, 17 Jun 2008 08:14:16 +0100, Trevor Best wrote:
    >
    >> On Tue, 17 Jun 2008 07:00:58 +0000, A J Hawke wrote:
    >>
    >>> Brilliant, thanks.
    >>> Just so I can make a note of it, what does the ./ symbolise?

    >>
    >> Current directory.

    >
    > So what we are saying to rm is;
    > 'Delete this belligerent file found in ./ and ignore where it is
    > pointing.' ?
    >
    > What I don't get is how it can be pointing to another location, like a
    > link, but ls -l shows it as a file and not a link. That is confusing me.


    There may well be a file of that name that somehow got there, but any
    attempt to access it via the shell will be intercepted and you get pointed
    to /var/backups because that's the home directory of user "backup".

    I don't know how it got there, but back in the DOS days I used to play
    jokes on people with files and create a file called "nul ", if anyone
    asked DOS to look at the file it would redirect to the nul device, you
    might want to check the file you can see in your directory is actually
    called that or does it have a space on the end or something.

    --
    Q: Want to lower petrol prices?
    A: Easy, just boycott BP & Esso



  11. Re: ~backup

    On Tue, 17 Jun 2008 19:06:24 +0100, Trevor Best wrote:

    > On Tue, 17 Jun 2008 09:37:23 +0000, A J Hawke wrote:
    >
    >> On Tue, 17 Jun 2008 08:14:16 +0100, Trevor Best wrote:
    >>
    >>> On Tue, 17 Jun 2008 07:00:58 +0000, A J Hawke wrote:
    >>>
    >>>> Brilliant, thanks.
    >>>> Just so I can make a note of it, what does the ./ symbolise?
    >>>
    >>> Current directory.

    >>
    >> So what we are saying to rm is;
    >> 'Delete this belligerent file found in ./ and ignore where it is
    >> pointing.' ?
    >>
    >> What I don't get is how it can be pointing to another location, like a
    >> link, but ls -l shows it as a file and not a link. That is confusing
    >> me.

    >
    > There may well be a file of that name that somehow got there, but any
    > attempt to access it via the shell will be intercepted and you get
    > pointed to /var/backups because that's the home directory of user
    > "backup".
    >
    > I don't know how it got there, but back in the DOS days I used to play
    > jokes on people with files and create a file called "nul ", if anyone
    > asked DOS to look at the file it would redirect to the nul device, you
    > might want to check the file you can see in your directory is actually
    > called that or does it have a space on the end or something.


    I think the default behaviour of the shell is the key, which is something
    that I completely overlooked. It was not a case of 'why is Linux doing
    this', but 'why is the shell doing this'. At that point there was a great
    flash of light ;-)

    As for your naughty tricks in the days of dos - you should be ashamed of
    yourself! I did a similar thing - installing this hideous bug script on
    pc's. What was it called? Windows ;-)

  12. Re: ~backup

    On Tue, 17 Jun 2008 18:40:36 +0000, A J Hawke wrote:

    > As for your naughty tricks in the days of dos - you should be ashamed of
    > yourself! I did a similar thing - installing this hideous bug script on
    > pc's. What was it called? Windows ;-)


    Oh but joke files are fun and easily created:

    trevor@leoben:~$ echo i/o Error reading disk > readme.txt
    trevor@leoben:~$ cat readme.txt
    i/o Error reading disk

    or of course the "File not found" message within a file was always a
    source of amusement.


    --
    Q: Want to lower petrol prices?
    A: Easy, just boycott BP & Esso



  13. Re: ~backup

    On 2008-06-17, A J Hawke wrote:
    > On Tue, 17 Jun 2008 08:14:16 +0100, Trevor Best wrote:
    >
    >> On Tue, 17 Jun 2008 07:00:58 +0000, A J Hawke wrote:
    >>
    >>> Brilliant, thanks.
    >>> Just so I can make a note of it, what does the ./ symbolise?

    >>
    >> Current directory.


    In more detail, '.' is the name of the current directory and '/' is the
    directory separator character we're all familiar with (and for which the
    wierd Windows people use '\').

    >
    > So what we are saying to rm is;
    > 'Delete this belligerent file found in ./ and ignore where it is
    > pointing.' ?
    >
    > What I don't get is how it can be pointing to another location, like a
    > link, but ls -l shows it as a file and not a link. That is confusing me.


    Actually, there's no pointing or linking involved; it's just a matter
    of preventing the shell (usually bash) from interpreting or expanding
    special characters, such as '$', '#', or '~', or '*'. This feature of
    the shell is often helpful, but sometimes it gets in the way - e.g.:

    touch \*

    You've now created a file named '*' (remove the quotes). But you better
    not try to remove it this way:

    rm *


    else you'll not only remove '*', but every other file in the current
    directory. And to fix this, the following won't work:

    rm ./* # You still end up removing everything in ./ .

    but this will:

    rm \*



    Fun with shells.


    --


  14. Re: ~backup

    On Wed, 18 Jun 2008 07:07:29 +0200, Jim Cochrane wrote:

    > touch \*
    >
    > You've now created a file named '*' (remove the quotes). But you better
    > not try to remove it this way:
    >
    > rm *
    >
    >
    > else you'll not only remove '*', but every other file in the current
    > directory. And to fix this, the following won't work:
    >
    > rm ./* # You still end up removing everything in ./ .
    >
    > but this will:
    >
    > rm \*



    what about:
    cp \* belligerent.file
    rm belligerent.file

    I don't want to try it myself, I value my filesystem ;-)

    On Tue, 17 Jun 2008 20:15:15 +0100, Trevor Best wrote:
    > Oh but joke files are fun and easily created:
    >
    > trevor@leoben:~$ echo i/o Error reading disk > readme.txt
    > trevor@leoben:~$ cat readme.txt
    > i/o Error reading disk
    >
    > or of course the "File not found" message within a file was always a
    > source of amusement.


    Ha! Having just started out in a linux based support role I have already
    been victim to that most amusing little ditty. Rotten sods!

    The one 'joke' that really really got me irate was a mate sending me
    spoof 'failure' emails. You know the thing, 'Unable to deliver you
    message - delayed for 72 hours'. He kept it going for nearly two weeks
    and it was only then I spotted the line 'Your message was delayed due to
    it being full of twaddle' or something of that nature.

    Oh how I laughed ;-)


  15. Re: ~backup

    On Wed, 18 Jun 2008 05:27:20 +0000, A J Hawke wrote:

    > The one 'joke' that really really got me irate was a mate sending me
    > spoof 'failure' emails. You know the thing, 'Unable to deliver you
    > message - delayed for 72 hours'. He kept it going for nearly two weeks
    > and it was only then I spotted the line 'Your message was delayed due to
    > it being full of twaddle' or something of that nature.
    >
    > Oh how I laughed ;-)


    Nice one, I must remember that.

    --
    I wish my lawn was EMO so it would cut itself.


  16. Re: ~backup

    On 2008-06-18, A J Hawke wrote:
    > On Wed, 18 Jun 2008 07:07:29 +0200, Jim Cochrane wrote:
    >
    >> touch \*
    >>
    >> You've now created a file named '*' (remove the quotes). But you better
    >> not try to remove it this way:
    >>
    >> rm *
    >>
    >>
    >> else you'll not only remove '*', but every other file in the current
    >> directory. And to fix this, the following won't work:
    >>
    >> rm ./* # You still end up removing everything in ./ .
    >>
    >> but this will:
    >>
    >> rm \*

    >
    >
    > what about:
    > cp \* belligerent.file
    > rm belligerent.file


    I think you, perhaps, meant:
    mv \* belligerent.file
    rm belligerent.file

    otherwise, the '*' file will still be there. Probably a good solution
    for those who get nervous using rm and '*' together.


    --


  17. Re: ~backup

    On Thu, 19 Jun 2008 23:46:02 +0200, Jim Cochrane wrote:

    > On 2008-06-18, A J Hawke wrote:
    >> On Wed, 18 Jun 2008 07:07:29 +0200, Jim Cochrane wrote:
    >>
    >>> touch \*
    >>>
    >>> You've now created a file named '*' (remove the quotes). But you
    >>> better not try to remove it this way:
    >>>
    >>> rm *
    >>>
    >>>
    >>> else you'll not only remove '*', but every other file in the current
    >>> directory. And to fix this, the following won't work:
    >>>
    >>> rm ./* # You still end up removing everything in ./ .
    >>>
    >>> but this will:
    >>>
    >>> rm \*

    >>
    >>
    >> what about:
    >> cp \* belligerent.file
    >> rm belligerent.file

    >
    > I think you, perhaps, meant:
    > mv \* belligerent.file
    > rm belligerent.file
    >
    > otherwise, the '*' file will still be there. Probably a good solution
    > for those who get nervous using rm and '*' together.


    Indeed. That is just what I meant and an error I make all the time.


    --
    begin broken-news-reader.exe

+ Reply to Thread