really really really clueless Terminal question

Discussion in 'macOS' started by Wie Gehts, Feb 21, 2008.

  1. Wie Gehts macrumors 6502

    Joined:
    Mar 22, 2007
    #1
    This terminal....does doing anything in it mess with the OS?

    When you do type in a command and run it, where does that command reside? Does it become part of your system? Can you go back delete a command? If so, where does it reside?

    I ask this because I purchased a small application that had a minor bug, so I couldn't use it. So they told me to type in this little one line command that would apparently alter the apps behaviour so it'll work right.....which it did do.

    Then they fixed the problem problem properly with an updated version of the application.

    So I'm wondering....what happened to that command I typed in? Did it disappear? Did it attach itself to OSX forever or something? Is it floating around in my computer somewhere? Don't like the sound of those things.
    I'm totally clueless.

    Thanks
     
  2. steveza macrumors 68000

    steveza

    Joined:
    Feb 20, 2008
    Location:
    UK
    #2
    Do you still know what the command was?

    Terminal is basically the operating system without graphics. There are a number of things that can only be done with commands in terminal and could be destructive so if you are not sure about something, get a second opinion.
     
  3. heatmiser macrumors 68020

    Joined:
    Dec 6, 2007
    #3
    Try "uptime" (without marks) to see how long your computer's been on.
     
  4. Wie Gehts thread starter macrumors 6502

    Joined:
    Mar 22, 2007
    #4
    heheheh....what does how long my computers been on have anything to do with anything? ;)

    The command was a simple one line that apparently told their application to do something differently so it would work for me.
    Their is also a little script amongst Logic users, either using 'nicer' or creating a script from a series of commands written in the terminal that supposedly helps, or not, Logic core overload stalling.

    The thing is...after you create these thing and either don't use them or don't need them anymore, where did these commands go? Into the ether? Still residing somewhere? If so, Where are they??

    :)
     
  5. kuwisdelu macrumors 65816

    Joined:
    Jan 13, 2008
    #5
    The Terminal command line is really just a different way to control your computer without using your mouse and graphics, etc. As steve said, it's basically your operating system without any graphics, just text commands. The graphical operating system that is OS X that you see is built upon an old, old operating system called Unix, which is kind of like the frame, seats, and painted exterior of a car built on top of a strong, complicated engine. Working with the Unix underbelly of OS X in Terminal is kind of like opening up the hood of the car and working on the engine.

    There's no such thing as a command "residing" anywhere on your system. It's not stored anywhere. It's just that--a command. You're telling your computer to do something just like you would with your mouse. The command is no more saved anywhere than the "double click" is saved anywhere when you double click a file to open it.

    E.g. the command

    Code:
    cd ~/Documents
    is more or less equivalent to you opening the Finder and double-clicking on your "Documents" folder to open it. It's just a different way to navigate to that folder (although in Terminal, they're referred to as "directories").

    The command

    Code:
    cd ~/Music/iTunes
    is the same as navigating to your Music->iTunes folder in Finder. You're currently in your iTunes folder in Terminal like you'd be in it in Finder. But you're in it the Unix way. (*Don't do this next step!) Now say you executed the command

    Code:
    rm -rf "iTunes Music"
    and you would delete your entire iTunes library. Poof! Gone. Not in the Trash or anything, just gone. The "rm" command tells your operative system to remove whatever follows. The "-rf" is an option, telling the "rm" command it's okay to delete it even if it's a directory (i.e., folder), and "iTunes Music" is just the thing you're telling to to delete (the quotes being necessary in this case because there's a space in the folder name). This command just the same as if you were in your iTunes folder in finder, highlighted your library, and hit delete (however instead of going to the Trash, the Terminal command actually deletes it--there's no Trash in Terminal).

    So I won't go into any more detail right now, but that's the basic idea. It's a good idea to know exactly what a command does before entering it, and when entering it, copy and paste, because the simplest typo could do something you didn't want.

    If a software update later comes and fixes whatever your Terminal command was meant to fix in the first place, there are a few possible things that could happen. 1) The "official" fix may do the exact same thing you did, and change the same files you did, or overwrite them, and you notice no difference, because it's the same as before. 2) The official fix corrects the problem in a different way, but overwrites whatever your change was in the process, so you don't notice anything again. 3) The official fix corrects the problem in a different way again, but in an unforeseen way that acts strangely combined with your Terminal "fix." Usually, you can find another Terminal command that will effectively "undo" what you did (you can't actually "undo" a command, but you can execute a command that does the opposite) and make everything work again. This 3rd scenario can be seen in people who used the Terminal command to change their Dock or make their menu bar opaque in 10.5.1 and then experienced strange side-effects in 10.5.2. If you know something's going to correct what you already used a Terminal command to correct, it's probably a good idea to find a Terminal command that effectively undos what you did, but this may not always be necessary.
     
  6. hodgjy macrumors 6502

    Joined:
    Apr 15, 2005
    #6
    I use the terminal to defragment my Windows XP virtual drive that's used in VMware Fusion.

    /Library/Application\ Support/VMware\ Fusion/vmware-vdiskmanager -d '/Users/Jay/Virtual Machines/Windows XP Professional.vmwarevm/Windows XP Professional.vmdk'
     
  7. Wie Gehts thread starter macrumors 6502

    Joined:
    Mar 22, 2007
    #7
    Thanks a million, kuwisdelu. :)

    Thats what I call one of the most specific and understandable explanation to a question that I had from posting on forums in a long time. A big thumbs up!
     
  8. Blubbert macrumors 6502

    Joined:
    Nov 1, 2006
    #8
    Actually, terminal commands are all independent little programs residing in a folder on your computer. Almost all are located in /usr/bin/ .
     
  9. tuxtpenguin macrumors regular

    Joined:
    May 19, 2007
    Location:
    TX
    #9
    True dat. But once the command has been issued, unless you save the output of the command, the command completes running and does not take up more space on the computer.
     
  10. Wie Gehts thread starter macrumors 6502

    Joined:
    Mar 22, 2007
    #10
    Groovy, but where is it? I can't find.

    thanks
     
  11. Wie Gehts thread starter macrumors 6502

    Joined:
    Mar 22, 2007
    #11
    OK. So they tell me to run that command. ( file > new command. I copy/paste what they sent me and hit <run>. I didn't do any saving. I quit terminal)

    I then open the app and it works.

    I close the app, then open the app again, and it still works.

    So..whats happening here?

    thanks
     
  12. JNB macrumors 604

    JNB

    Joined:
    Oct 7, 2004
    Location:
    In a Hell predominately of my own making
    #12
    You've changed a variable in the app through a terminal (command line) command, like changing a flag or bit from 0 to 1. It's permanent, like changing a preference setting, until you change it back.

    If you've never worked in a command line environment (DOS, *nix, etc.), I would be careful about employing Terminal and entering commands if you don't know what they do from your own knowledge, rather than someone telling you what it does. Your entire system, file structure & all, is laid bare, and in Unix systems, there's no "Are you Sure Y/N?" to act as a safety net. It's very powerful, but it's a one-way street.

    And shame on you yeroen, that's not nice. ;) Would you have helped the OP recover if they'd followed your suggestion? :eek:
     
  13. aross99 macrumors 68000

    aross99

    Joined:
    Dec 17, 2006
    Location:
    East Lansing, MI
    #13
    It's hard to tell what you did without the command, but chances are, it only did something to effect their application, and is probably nothing to worry about...
     
  14. kuwisdelu macrumors 65816

    Joined:
    Jan 13, 2008
    #14
    Yes, in that sense, the commands do reside there, but that's not in the same sense as what the OP asked. To say his commands reside in /usr/bin is as misleading as telling him his mouse click is a file stored somewhere--which in a sense it is--as a console log and the code telling the computer how to interpret that mouse click, but in the sense that the OP asked, there's no way to go back to the moment of that click and undo it or "delete" that click from ever existing. So what you're saying is technically correct, but it's kind of misleading.

    As John said, you've most likely changed a few variables that the program uses to tell it how to work, which are permanent changes until you change them back.

    And you don't need to go to "new command" like that. You can just type it in (well, copy + paste is better, yes) to the Terminal window that opens up when you start Terminal, and then hit "Enter."
     
  15. heatmiser macrumors 68020

    Joined:
    Dec 6, 2007
    #15
    Are you trying to figure out what you entered into the Terminal? You can just tap the up arrow a few times to see the last commands entered.
     
  16. Wie Gehts thread starter macrumors 6502

    Joined:
    Mar 22, 2007
    #16
    HI..thanks for your help....

    Naw, its was a totally legit fix. I bought 'Airfoil' and it wasn't connecting to my airport. So the developer sent me a single line command to change a small variable in the program that made it work. However the next day they fixed the glitch in a new update of the application. So now I'm using the newest version and it works like its supposed to.

    It just got me wondering if doing anything like that is doing anything funky to my OS and if its some kind of 'permanent' piece of code or something let loose inside my system that I no longer have any use for.

    :)
     
  17. kuwisdelu macrumors 65816

    Joined:
    Jan 13, 2008
    #17
    You've probably figured this out by now, but no, that's not the case ;)

    Especially if the developer sent it to you, I suspect all the update did to fix it was change the same thing you did. There are some cases a Terminal command could be dangerous, but what you did in this case is about as dangerous as going into "Preferences" in any application and changing around a few settings. That's not always the case, but as long as you trust the source of your commands, you've nothing to worry about. And don't trust yereon.

    The /usr/bin directory is hidden normally. If you enter the following into Terminal you can see the files there:

    Code:
    cd /usr/bin
    ls
    
    Here "cd" means "change directory" and "ls" lists the files in the current directory. Don't actually do anything in here. Just look. Quit Terminal when you're done. These aren't actually the commands *you* entered (like say a few minutes ago). These just tell your system how to interpret the different commands you type. If you're looking here to find the commands you entered to make your application work, you won't find them. You can think of this as more or less a "dictionary" of commands that the system looks at to execute whatever you've typed.
     
  18. Wie Gehts thread starter macrumors 6502

    Joined:
    Mar 22, 2007
    #18
    Thanks kuwisdelu, you've been very helpful and clear in your explanations. :)

    and some of you other guys, thanks for your input too. :)
     
  19. kuwisdelu macrumors 65816

    Joined:
    Jan 13, 2008
    #19
    No problem :D

    I know where you're coming from in cluelessness, so I try to explain it in terms that would have been helpful to me when I was where you are.
     

Share This Page