Single User Mode command list

Discussion in 'OS X' started by pieman69, Oct 17, 2009.

  1. macrumors newbie

    Joined:
    Oct 17, 2009
    #1
    I've stupidly moved (not deleted) a couple of shortcut links to items in the 'private' folder, from their correct place resulting in my Macbook Pro (10.5) refusing to boot.

    The files were resident in the top level of the Macintosh HD after enabling the viewing of hidden files using console. I created a new folder at the same level and moved the files into it.

    Problem is I cant remember the specific file names that i moved - though it was only a couple )!!

    I have started up in single user mode and know the commands for moving files around, but need to be able to view the folder/file structure of the disk.

    Is there a command usable from Single User interface that would list the files/folder structure?
     
  2. macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #2
    It actually tells you how to do it right above the prompt.

    Run
    Code:
    fsck -y
    then

    Code:
    mount -uw /
     
  3. thread starter macrumors newbie

    Joined:
    Oct 17, 2009
    #3
    Thanks for the reply.

    I can mount the disk without a problem using the 'mount -uw' prompt, however what i need is effectively a list of the folders/subfolders on the disk.
    without this information i am unable to identify which files i need to recover.

    Once i can see the folder/file list i will know straight away which they are.
    It was only 2 files that i moved. the 'var' and 'etc' i think, but not 100% sure.
     
  4. macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #4
    You can use any unix commands.

    But here are a few that should help you a bit.

    ls will list the directories and files relative to where you are.

    cd xxx will allow you to change directories. For example cd var (if you are in the root) and cd /var if you are elsewhere.

    mv will allow to you move files. For example:
    mv /var/myfile /users/shortname/myfile

    That will move the file from var to the root of your home folder.

    Since it sound like you will be working in system directories, you will need to add sudo before a command that will manipulate files.

    So you would need to use if before the mv command, but not cd or ls.

    Hope that helps.
     
  5. macrumors 68030

    Darth.Titan

    Joined:
    Oct 31, 2007
    #5
    sudo isn't necessary in single-user mode. In single user mode you are effectively logged in as root.

    The other commands mentioned will probably be useful, but the original request to view file structure can be achieved with the ls command. you'll probably want detailed listings to view permissions, ownership, etc. so ls -la is probably your best bet.

    If there are too many files/directories to view on one screen ls -la | more should do the trick. That will pause the listing a screen at a time and you can advance to the next screen with the spacebar. don't forget to brush up on any of these commands with man <command>

    You should probably prepare yourself to use your install disc for a clean install to fix things though.
     
  6. macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #6
    Forgot you don't need sudo. I did mention ls though, although not a detailed.
     
  7. thread starter macrumors newbie

    Joined:
    Oct 17, 2009
    #7
    Thanks for all the advice.

    I will be giving it a go tomorrow and keep you posted.

    Cheers
     
  8. macrumors newbie

    Joined:
    Dec 22, 2011
    #8
    I have a similar issue. In 'get info' I unlocked and 'applied to all' in some folders that I should not have, now I can't boot. Stuck on gray screen with logo. Used some fsck commands and it appeared all the files were ok but still no startup. Any suggestions?
     

Share This Page