Saturday, May 28, 2011

Setting custom Prompt

As much as I know maximum linux family's users were Windows users previously or using Linux parallel with Windows/Mac OS. I was too a Windows user previously, now fully switched to Linux.
In Windows, we have seen prompt command in command prompt(cmd) to change the prompt of the cmd.

Today I am going to discuss about same thing for linux.
In Linux, PS1 shell variable sets the prompt. We can use this variable to set our own custom prompt with the use of special escaped sequences.
Here, are few common escape sequences:
\h - short hostname
\u - username
\w - current working directory
\! - history number of the current command
\$ - this shows the privilege i.e for root users # and for non-root users $
Setting custom prompt using special escaped sequences:
1. temporary change:
$ PS1="\u@\h: \w \$" this will give you prompt something like this:
prabindatta@localhost: /home/prabindatta $

2. to make this change permament:
$ vi /.bashrc
at the end append your line something like this:
PS1='\u@\h: \w \$'

1 comment:

  1. Visit To All Types Of Printers Technical Supports | Call Now +1-855-517-2433

    Solution Visit To Technical Supports For Hp Printer | +1-855-517-2433

    Solution Visit To Technical Supports For Canon Printers | +1-855-517-2433

    Solution Visit To Canon Printing Problems and Solution | +1-855-517-2433

    Solution Visit To Canon Printing Problems and Solution | +1-855-517-2433

    Solution Visit To Technical Supports For Hp Printer | Call Now +1-855-517-2433

    Solution Visit To Technical Supports For Dell Printer | Call Now +1-855-517-2433
    Solution Visit To Technical Supports For Hp Printer | +1-855-517-2433

    Solution Visit To Technical Supports For Canon Printers | +1-855-517-2433

    Solution Visit To Canon Printing Problems and Solution | +1-855-517-2433

    Solution Visit To Canon Printing Problems and Solution | +1-855-517-2433

    Solution Visit To Technical Supports For Hp Printer | Call Now +1-855-517-2433

    Solution Visit To Technical Supports For Dell Printer | Call Now +1-855-517-2433
    Solution Visit To Technical Supports For Hp Printer | +1-855-517-2433

    Solution Visit To Technical Supports For Canon Printers | +1-855-517-2433

    Solution Visit To Canon Printing Problems and Solution | +1-855-517-2433

    Solution Visit To Canon Printing Problems and Solution | +1-855-517-2433

    Solution Visit To Technical Supports For Hp Printer | Call Now +1-855-517-2433

    Solution Visit To Technical Supports For Dell Printer | Call Now +1-855-517-2433
    Solution Visit To Technical Supports For Hp Printer | +1-855-517-2433

    Solution Visit To Technical Supports For Canon Printers | +1-855-517-2433

    Solution Visit To Canon Printing Problems and Solution | +1-855-517-2433

    Solution Visit To Canon Printing Problems and Solution | +1-855-517-2433

    Solution Visit To Technical Supports For Hp Printer | Call Now +1-855-517-2433

    Solution Visit To Technical Supports For Dell Printer | Call Now +1-855-517-2433

    ReplyDelete