PS1 is evaluated each time the shell prints the prompt, so you can have it
show environment variables, and/or use the following
\w current work directory
\h hostname
\u username
\! history event number
\d date
\t time
\a ring the "system bell"
Example:
,% PS1="\u@\h\!: "
z123456@turing22:
Give this one a try later!
bash shell prompt example
Number of arguments (short for argument
count)
Give this one a try later!
What is argc?
platform type, i386, x86_64, ppc
Give this one a try later!
hosttype
Formally, regular expressions consist of:
• atoms
• operators
An atom indicates which text is to be matched and where it is to be found.
An operator is used to combine regular expression atoms.
Give this one a try later!
, Regular expressions
absolute path to your system mailbox
Give this one a try later!
mail
The alias command aAllows you to assign an alias, to command(s). An
alias is another name for something, and when you type it as a command,
it will run the command it is an alias for.
To check current aliases:
% alias
To set alias:
% alias ll="ls -al"
To remove alias:
% unalias ll
Give this one a try later!
shell aliases
separates alternative regular expressions
Give this one a try later!
, Meta characters | or \|
Each command in history has a sequential event number
to view the history buffer:
history [c] [count]
• If no options are supplied, list all history
• c clears history
Size of history (in lines) can be set via shell variables:
HISTSIZE=500
HISTFILESIZE=100
You can re-execute history events:
• By last command
• % !!
• By the event number
• % !5
• By the number relative to current event (ago)
• % !3
• By the text of the command used
• % !ls
The shell replaces these with the full text of the history event command
line. Anything you type after them will be appended to what was typed on
the repeated event.
Give this one a try later!
shell history
update modifications date on a file without changing its contents or create a file if it
doesn't exist.
Give this one a try later!
show environment variables, and/or use the following
\w current work directory
\h hostname
\u username
\! history event number
\d date
\t time
\a ring the "system bell"
Example:
,% PS1="\u@\h\!: "
z123456@turing22:
Give this one a try later!
bash shell prompt example
Number of arguments (short for argument
count)
Give this one a try later!
What is argc?
platform type, i386, x86_64, ppc
Give this one a try later!
hosttype
Formally, regular expressions consist of:
• atoms
• operators
An atom indicates which text is to be matched and where it is to be found.
An operator is used to combine regular expression atoms.
Give this one a try later!
, Regular expressions
absolute path to your system mailbox
Give this one a try later!
The alias command aAllows you to assign an alias, to command(s). An
alias is another name for something, and when you type it as a command,
it will run the command it is an alias for.
To check current aliases:
% alias
To set alias:
% alias ll="ls -al"
To remove alias:
% unalias ll
Give this one a try later!
shell aliases
separates alternative regular expressions
Give this one a try later!
, Meta characters | or \|
Each command in history has a sequential event number
to view the history buffer:
history [c] [count]
• If no options are supplied, list all history
• c clears history
Size of history (in lines) can be set via shell variables:
HISTSIZE=500
HISTFILESIZE=100
You can re-execute history events:
• By last command
• % !!
• By the event number
• % !5
• By the number relative to current event (ago)
• % !3
• By the text of the command used
• % !ls
The shell replaces these with the full text of the history event command
line. Anything you type after them will be appended to what was typed on
the repeated event.
Give this one a try later!
shell history
update modifications date on a file without changing its contents or create a file if it
doesn't exist.
Give this one a try later!