Computer History - Herong's Notes - Version 3.11, by Dr. Herong Yang
Bash Command Line Examples
This section provides some Bash shell command line examples with explanations.
Below are some Bash shell command line examples with explanations:
set Displays the values of all variables, global and local variables. env Displays the values of all environment (global) variables. echo $- Tests of shell mode. The shell is interactive, if it contains an 'i' in the value. alias ..='cd ..; pwd' Sets an alias command of ".." to change current directory to the parent directory. PS1=\$ Sets the prompt to be the dollar sign $ D=`pwd` Sets the current working directory to a local variable D. export D Exports the local variable D to be a global variable, so that any sub shells can use it. echo $D Displays the values of variable D. cat > myself (Type in some words about yourself) ^D Creates a file and lets you to enter text from the keyboard. cat myself Displays the contents of "myself" on the screen. sleep 200 ^C "Ctrl-C" cancels the execution of the sleep command. sleep 200 ^Z "Ctrl-Z" stops the execution of the sleep command and pushes it to background. sleep 200 & Runs the sleep command in the background. jobs Lists all background jobs. history Lists all previously executed command lines
Table of Contents