CPUG

The Check Point User Group

A Resource For The Check Point Community.  Fast.  Useful.  Independent.

1. CCSA/CCSE One-Week Dual-Certification Training Course with CPUG in San Francisco!
    Courses Starting 12/8, (2009) 1/19, 2/9, 3/9, 4/6, 5/4, 6/8, 7/6, 8/3.
2. Join Us On LinkedIn - We now have a CPUG group.


Go Back   CPUG: The Check Point User Group > Check Point Firewall-1/VPN-1 And Related Products > Miscellaneous
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2006-11-14
Junior Member
 
Join Date: 2006-11-01
Posts: 3
Rep Power: 0
affinityhb has an average reputation (10+)
Default Show date/time and cwd in command prompt

I was looking to see if it was possible to have the command prompt actually show date time and current working directory as well as user.

I have gotten it to show these values but it is not dynamic.
hence if I change directory it doesn't change it in the prompt.
Same with the time/date. time does not dynamically change err.. show current time for every command line.

Currently I have this:

set prompt="`hostname -s`-`date`[$USER]$cwd #"

I am looking to do this for tracking and auditing purposes.
Any help would be greatly appreciated.
Reply With Quote
  #2 (permalink)  
Old 2006-11-14
Senior Member
 
Join Date: 2006-01-26
Location: Moscow, Russia
Posts: 706
Rep Power: 3
kva.kva has an average reputation (10+)
Default Re: Show date/time and cwd in command prompt

Try this from expert mode
PS1='[$HOSTNAME - `/bin/date` $USER]# '

You can change PS1 in /etc/bashrc file.
Reply With Quote
  #3 (permalink)  
Old 2006-11-14
Junior Member
 
Join Date: 2006-11-01
Posts: 3
Rep Power: 0
affinityhb has an average reputation (10+)
Default Re: Show date/time and cwd in command prompt

Sorry I neglected to note that i am on Nokia and there is only csh
Reply With Quote
  #4 (permalink)  
Old 2006-11-14
Senior Member
 
Join Date: 2006-04-30
Location: Europe, Germany
Posts: 153
Rep Power: 3
dsb.nepo has an average reputation (10+)
Default Re: Show date/time and cwd in command prompt

My personal favorite.
It shows dynamic time, user, hostname, path. The new line is personal taste for long commands.

export PS1="[\A \u@\h:\w]\n\\$"

In expert mode it will show always root as user until you modify /etc/bashrc

more options:
Code:
\d     the date in "Weekday Month Date" format (e.g.,  "Tue  May 26")
\e     an ASCII escape character (033)
\h     the hostname up to the first `.'
\H     the hostname
\j     the number of jobs currently managed by the shell
\l     the basename of the shell's terminal device name
\n     newline
\r     carriage return
\s     the name of the shell, the basename of  $0  (the  portion following the final slash)
\t     the current time in 24-hour HH:MM:SS format
\T     the current time in 12-hour HH:MM:SS format
\@     the current time in 12-hour am/pm format
\A     the current time in 24-hour HH:MM format
\u     the username of the current user
\v     the version of bash (e.g., 2.00)
\V     the release of bash, version + patch level (e.g., 2.00.0)
\w     the current working  directory,  with  $HOME  abbreviated with a tilde
\W     the basename of the current working directory, with $HOME abbreviated with a tilde
\!     the history number of this command
\#     the command number of this command
\$     if the effective UID is 0, a #, otherwise a $
\nnn   the character corresponding to the octal number nnn
\\     a backslash
\[     begin a sequence of non-printing characters, which  could
       be  used  to  embed  a terminal control sequence into the prompt
\]     end a sequence of non-printing characters
Reply With Quote
  #5 (permalink)  
Old 2006-11-14
Senior Member
 
Join Date: 2006-04-30
Location: Europe, Germany
Posts: 153
Rep Power: 3
dsb.nepo has an average reputation (10+)
Default Re: Show date/time and cwd in command prompt

ok, it is nearly the same:

set prompt = "[%P `whoami`@%m:%/ ]\n# "

If you need more options try this man page http://www.freebsd.org/cgi/man.cgi?q...SE&format=html
Reply With Quote
  #6 (permalink)  
Old 2006-11-15
Junior Member
 
Join Date: 2006-11-01
Posts: 3
Rep Power: 0
affinityhb has an average reputation (10+)
Default Re: Show date/time and cwd in command prompt

I tried this but it did not work.

I beleive that the version of csh on NOKIA is a bit different (stripped)
I am still checking CHECKPOINT and NOKIA websites.

fwname[admin]#
fwname[admin]# set prompt = "[%P `whoami`@%m:%/ ]\n# "
whoami: Command not found.
[%P @%m:%/ ]\n# csh
fwname[admin]#
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -7. The time now is 01:23.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0