Need help with terminal

Discussion in 'Mac Programming' started by Rizzo96, Jan 2, 2017.

  1. Rizzo96 macrumors newbie

    Joined:
    Jan 2, 2017
    #1
    I'm taking a programming course online that uses codeblocks. All my programs have been running fine, but I receive this annoying message at the top of my terminal whenever I run a program. Does anyone know how to get rid of it?

    I'm talking about the message thats says at the top "Rizwans-MacBook-Pro:~MacBook$ ... /Debug/InteractiveProgram"

    https://puu.sh/t9lkx/7d015f8a30.png

    Also, when I open a new terminal window this message pops up

    https://puu.sh/t9llv/5a6830108e.png
     
  2. Sander macrumors 6502

    Joined:
    Apr 24, 2008
    #2
    This message is called the "prompt". It currently shows you the name of the machine you're on and the directory you're in ("~ is short for "home"), and the fact that you're logged in as a normal user ("$") as opposed to "root" (which would have a "#" prompt). All this stuff is configurable, but these are the default settings.
     
  3. Rizzo96 thread starter macrumors newbie

    Joined:
    Jan 2, 2017
    #3
    Do you know how I can surpress all of that so when I run my code it won't appear?
     
  4. techwarrior macrumors 6502

    techwarrior

    Joined:
    Jul 30, 2009
    Location:
    Colorado
    #4
    The title Bar at the top of the window can be changed in Preferences > Profiles > Window > Title. I think default is the working directory or document which is what you are seeing. Try some of the other settings. I suspect this is what you are referring to with the second screenshot as well, but if it is the command prompt "Rizwans MBP...", the command prompt can be manipulated by tinkering with your .bash_profile and\or .bashrc in your home directory. This guy has posted a decent place to start, but every user has his own preferences so you will find thousands of articles on the topic:

    https://natelandau.com/my-mac-osx-bash_profile/
     
  5. aaronvan Suspended

    aaronvan

    Joined:
    Dec 21, 2011
    Location:
    República Cascadia
    #5
    BTW, if you're going to spend a lot of time in the terminal you might want to explore some other options besides MacOS default. I use iTerm2 and quite enjoy it.
     
  6. Toutou macrumors 6502a

    Toutou

    Joined:
    Jan 6, 2015
    Location:
    Prague, Czech Republic
    #6
    The Terminal app is essentially a terminal emulator. And a real (hardware) terminal works pretty much like a typewriter. Whatever is "typed" (printed on the screen), stays there.

    You need to understand that the prompt isn't "being displayed" on top of your program, or something like that. It has just been printed and now sits there until enough new text is added (printed) and it moves away.

    The shell (the command line interface) running in the terminal runs in an infinite loop:
    ----
    1. print the prompt
    2. read a command
    3. execute that command and print any output
    ----
    Without the prompt the user wouldn't know whether his command is still being executed or if the computer is ready to accept new input. That's why it's necessary.

    This is just the nature of working with the terminal. Terminal users don't expect beautiful and tidy graphical interfaces, so don't worry about this.

    If you for whatever reason need to clear the screen you can insert enough new lines to get the previous text offscreen. And this is not a dirty hack, that's how it's done.
     
  7. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #7
    There's a command named 'clear' that clears the window. However, it does this by emitting newlines for the height of the window. That is, you can scroll back and see previous commands and their output.
     
  8. aaronvan Suspended

    aaronvan

    Joined:
    Dec 21, 2011
    Location:
    República Cascadia
    #8
    MacOS actually has two terminals available: the default terminal and Xterm.
     
  9. ocabj macrumors 6502a

    ocabj

    Joined:
    Jul 2, 2009
    #9
    It depends what shell you use. I'm guessing bash since it is default. Full documentation here: https://www.gnu.org/software/bash/

    Essentially, you're going to modify your PS1 environment variable. Read: https://linuxconfig.org/bash-prompt-basics

    There are many ways to tweak/customize your PS1 env var. Read the aforementioned link to set it what you want. There are many reasons why you want your prompt to at least give some indicator on what host your shell is running on.
     

Share This Page