Change your Terminal prompt – Lost style

Fancy a change from the default prompt you get in your Terminal? Want to mimic the Terminal prompt used in Lost? I did, and during a boring lecture at Uni, decided to update it.

Lost Terminal Prompt

I’m using zsh currently, but this will also work for a bash shell (default with Mac OS X). I’m using TextMate to edit my files, but if you’re on Linux (Ubuntu, right?), then just substitute the mate command for nano or your favourite editor.

Just to make sure that you’re in your home directory:

cd ~

Now open your shell profile. If you’re using zsh:

mate .zprofile

Or if you’re using bash:

mate .bashrc

Now add the following line:

export PS1=">: "

Save and close the file.

Now, make sure you have the right colour scheme going on.

  1. ‘Terminal’ from the main menu.
  2. Select ‘Window Settings’
  3. Select ‘Color’ in the drop down
  4. Select ‘Green on Black’ from the ‘Standard Color Selections’
  5. Click the big ‘Use Settings as Defaults’
  6. Close the window, and you’re done

Open a new Terminal window and you should get a nice Lost ‘style’ for your prompt. Nothing too fancy–just something nice and simple.

Lost style Mac prompt

Now, you only have 108 minutes to enter the code… so don’t waste time!

Damn. I can’t wait until the next episode.

2006-12-06 [, , , ]
  • http://www.chnepr.com thebjwilliams

    Nice work dude.

    Now, if you could only get my kidnapped son with mysterious powers of manifestation and premonition chatting with me. . .

  • http://davidwinter.me.uk David

    That’ll be a little tricky… but I’ll try my best.

  • http://www.asleep.net/ A.Sleep

    Just an FYI. I use the following version: \n\w\n>: That gives an empty line then the working directory followed by another newline and the >: prompt. It should also be noted that you can right-click on the term, select Window Settings, select Color from the dropdown then set your Standard Color Selections to green on black. I also set the text to Monaco if it’s not already and check the blink checkbox along with anti-aliasing (all in the Display section). Don’t forget to click Use Settings as Defaults when you are done.

  • http://www.wo-gibt.de Steffen

    Funny – now you only need to implement a real countdown that e.g. erases the hard drive if you don’t enter the numbers before the 108 minutes.

  • http://www.zerokernel.com polozero

    hi, if you had installed fink, you have to add it to “.profile”, if you do it to “.bashrc” don’t work, :D , I guess It has priority… by the way it looks cool :D, I remember my monochrome display…

  • Jacko

    Cool thing!

    I had to write it in .bash_profile instead of .bashrc in order to make it work straight away though.

    I also made a short script named ’4′ in my /bin/ directory that does a clear, so you get a clear screen when you enter the sequence :)

  • http://www.themancan.com Brett

    Great tip. I had to use .bash_profile as well, so thanks Jacko for that note.

    The >: makes it so much easier to focus on the output (mostly ToDo.txt stuff) than a long and garbled string. Very handy.

  • http://osxdaily.com/2006/12/11/how-to-customize-your-terminal-prompt/ OS X Daily » How to Customize your Terminal Prompt – Mac OS X Apps, Tips, Tricks, News, Updates, Everything Mac OS X

    [...] So, play around and see what you prefer. By the way, if you’re new to the Terminal text editor nano, you save a file by hitting control-o, and you exit the file and program by hitting control-x. You can also just use a standard text editor, like TextWrangler or TextEdit. There’s also a simple how-to designed to make your Terminal prompt resemble the one from the TV show LOST, but it is less useful in the real world, read that here if you are interested. [...]

  • http://www.dailyclerks.com/index.php/hacks/the-lost-prompt/ Daily Clerks

    [...] Blogger David Winter has a posted a cute how-to showing you how to change the prompt in your terminal to the “>:” used in Lost. [...]

  • http://samdanielson.com Sam Danielson

    On Ubuntu don’t forget it’s ‘sudo 4 8 15 16 23 42′. I recommend the NOPASSWD option in the sudoers file for those times when you have to enter the code at the last second.

  • http://digicted.nl/weblog/2007/10/30/howto-bash-terminal-mac-os-x-afstellen/ HOWTO: Bash terminal in Mac OS X afstellen | Digicted

    [...] Waar sommige mensen hun terminal op die van Lost willen laten lijken (zie ook deze reactie) ben ik meer voor een informatieve prompt met een lichte achtergrond. [...]

  • MacNoob

    Thanks! Right after I “chsh -s /bin/zsh” I’ll “vim .zprofile”

  • http://www@www.com user123

    If you’re on OSX and the .bashrc doesn’t work, go into the Terminal preferences. Under the Shell tab, enable the terminal to execute bash on startup, and run it inside the shell. Your .bashrc should execute.

blog comments powered by Disqus