[HOW TO]Terminal Basics

Discussion in 'iPod touch Firmware 2.X Jailbreak' started by Pelaez-1, Sep 6, 2008.

  1. Pelaez-1

    Pelaez-1 New Member

    Joined:
    May 5, 2008
    Messages:
    822
    Likes Received:
    0
    Device:
    iPhone
    Since MobileFinder is not working to move files within the device, or at least not with modifying it, I decided to make a little "tutorial" about Terminal (you'll need to install MobileTerminal from Cydia to use this. I reccomend that you put it in BossPrefs' dock, so that you can let other people play with your iPod/Phone without access to the Terminal, I also recommend that you change your password instructions below))

    So:
    This is what I know so far, I haven't gotten to permissions, so I'm not too sure about how to change permissions, but if you want me to add it, just PM me on how to do it and I'll update this thread.

    These are the basics I use the most, if you need more, you can google UNIX terminal help or something like that, and you'll probably find a lot of stuff.

    If you think I missed anything, or something is not clear, you can PM me or reply here and I'll update the thread.

    First, you start in the folder /var/mobile with mobile privileges. If you want to move, rename, delete, and change permissions you need to log is as root, I'll cover that a little bit further.

    Common commands (you don't need to log as root to use these):

    cd - changes directory. Example, if you are in /var, and type "cd mobile", you'll go to /var/mobile

    Uses of cd:
    "cd .." - takes you up one level, say you are on /var/mobile, and type "cd ..", you'll be on /var
    "cd ~" - takes you to /var/mobile
    "cd *folder path*" will take you to that folder

    ls - lists the directories and files in the folder you are in, really useful

    Uses of ls:
    "ls" - just displays the files and folders in the directory you are in
    "ls ~" Displays the contents of /var/mobile
    "ls *folder path*" displays the contents in the folder you specified

    less - displays a text file within the terminal
    Uses:
    "less document.txt" will display the text in document.txt, given that is a text document.

    Root commands - to use these, you need to log in as root, so just type "su root", and it will ask you for your password. Default is alpine (though I recommend that you change it), and it's ok if when you type your password the letters don't show up, it's for security.

    passwd - This will change the password, after you loged in as root, type passwd and it will ask you to type your new password twice. Again, while you type it won't show anything, don't worry, that's for security. PLEASE use something you'll remember

    Please Register or Log in to view images



    mkdir - makes a folder inside the folder you are in
    Example:
    "mkdir MyTheme.theme" will create the folder MyTheme.theme in the folder I am browsing at that time

    mv - moves and renames files and folders
    Examples:
    "mv file1.txt file2.txt" will rename from file1.txt to file2.txt
    "mv file1.txt /var/mobile/file1.txt" will move file1.txt to /var/mobile/

    rm - CAREFUL WITH THIS. this one is to delete files, but you have to be careful on how you use it, or you can delete important files. If you are deleting something, enter the full name of the file/folder (i'll explain why in a little)
    Example:
    "rm MyTheme.theme" will delete the folder MyTheme.theme, if it is in the directory I am browsing, otherwise it will send a message saying it didn't find the file.

    cp - Copies a file or folder, the syntax is similar to mv (I have not used this much though)
    Examples:
    "cp file1.txt file2.txt" will create a new file called file2.txt that is a copy of file1.txt, in the same directory
    "cp file1.txt /var/mobile/file1.txt" will make a new file that is a copy of file1.txt in /var/mobile/, named file1.txt


    Tips:
    If you don't want to write the full name of a folder, or don't know the exact name, there are some characters you can use.

    ? - will act as any ONE character, so let's say you want to go to Themes.8Hd61k, but don't remember the last 6 characters, you type "cd Themes.??????" and voila

    * - is even more lazy, if you want to go to Themes.8Hd6k, you can just type "cd The*" and the * will act as the rest of the folder name. Note that you have to make sure that there's only one folder that starts with The.
    Say you have a folder called Theme1, and another one called Theme2, you have to write the full name, otherwise it will take you to whatever folder it wants (probably to Theme1, as it goes before)

    NOTE: In all the commands, remove the ""s, I just used them to make it easier to know where it starts and ends.

    Hope it all was easy to understand, english is not my primary language

    Please Register or Log in to view images

    .

    Any doubts, just reply or PM me.
  2. Tman47

    Tman47 Active Member

    Joined:
    Feb 13, 2008
    Messages:
    2,883
    Likes Received:
    20
    Device:
    iPhone 4S (Black)
    this is great!
  3. Jikoo

    Jikoo New Member

    Joined:
    Apr 5, 2008
    Messages:
    1,014
    Likes Received:
    0
    cool, nice
  4. Pelaez-1

    Pelaez-1 New Member

    Joined:
    May 5, 2008
    Messages:
    822
    Likes Received:
    0
    Device:
    iPhone
    Wow, that was a fast response

    Please Register or Log in to view images

  5. ricardofelix95

    ricardofelix95 Banned

    Joined:
    Mar 16, 2008
    Messages:
    2,702
    Likes Received:
    4
    Nice, but I use MobileFinder from the App Store.

    Please Register or Log in to view images

  6. Gitykins

    Gitykins Banned

    Joined:
    May 16, 2008
    Messages:
    3,760
    Likes Received:
    1
    1) Install Linux/UNIX
    2) Fail miserably for days until you learn basic commands
    3) Open iPod terminal, use as neccessary.

    Simple, short, three step guide.

    Edit: If you want, I can make a permissions/owners, etc, part of the guide.
  7. wrestler1256

    wrestler1256 New Member

    Joined:
    Dec 29, 2007
    Messages:
    205
    Likes Received:
    0
    Device:
    iPod touch
    as he said in the post
    this can do many things moble finder cant
  8. Pelaez-1

    Pelaez-1 New Member

    Joined:
    May 5, 2008
    Messages:
    822
    Likes Received:
    0
    Device:
    iPhone
    Yep, this is what I've learned from the first two steps of your guide

    Please Register or Log in to view images



    Sure, make the permissions part and PM me it to me, and I'll give you the credit for it.
  9. Steaps

    Steaps New Member

    Joined:
    Oct 24, 2007
    Messages:
    5,074
    Likes Received:
    41
    Device:
    iPod touch
    http://www.ifans.com/forums/showthread.php?t=50449

    Although, more than one can't hurt. Especially when it's updated.

    Please Register or Log in to view images

    .
    Also, for the "?" that's news to me, thanks!
  10. Gitykins

    Gitykins Banned

    Joined:
    May 16, 2008
    Messages:
    3,760
    Likes Received:
    1
    Some of those would make your iPod fail miserably on 2.0.x

    Mostly these:

    mkdir /private/var/Applications
    cp -Rp /Applications/* /private/var/Applications
    rm -rf /Applications && ln -s /private/var/Applications/ /Applications
    reboot

    chown -hR mobile /var/mobile

    chmod +x /Applications/AppName.app/AppName

Share This Page