In January 2008, the University replaced the bgunix system we have been using since 2002. The new system uses the bash shell,
very similar to the ksh shell used in the previous bgunix.
The following table describes some common Unix commands and features, showing them for both ksh (old bgunix) and bash (new
bgunix). Those that are different on the new system are shown in color.
| Command or feature |
ksh (previous bgunix) |
bash (new bgunix) |
| Commands executed when logging in |
.profile
|
.bash_profile
|
| Commands executed with each process |
.kshrc |
.bashrc |
| Display the contents of a file on the screen |
cat |
cat |
| Return to the login directory |
cd |
cd |
| Change default directory to directory-name |
cd directory-name |
cd directory-name |
| Clear the terminal screen |
clear |
clear |
| Copy file source to dest |
cp source dest |
cp source dest |
| Interrupt the execution of the current program |
[Control]-c |
[Control]-c |
| Log off the system |
exit or [Control]-d |
exit or [Control]-d |
| List files waiting to be printed |
lpq |
lpq |
| Send a file to the printer |
cslpr filename |
cslpr filename |
| Lists the files in the current directory |
ls |
ls |
| Lists the files in the current directory, with more info. |
ls -l |
ls -l |
| Create a subdirectory called dir-name |
mkdir dir-name |
mkdir dir-name |
| Display information about a unix command |
man command |
man command |
| View a file one page at a time |
more filename |
more filename |
| Rename a file |
mv old-name new-name |
mv old-name new-name |
| Change your password |
passwd |
passwd |
| Save a session in a photo file |
photo log-file-name |
photo log-file-name |
| Create or edit a file |
vi filename or pico filename |
vi filename or pico filename |
| Display the current default directory |
pwd |
pwd |
| Delete (remove) a file |
rm filename |
rm filename |
| Delete (remove) an empty directory |
rmdir dirname |
rmdir dirname |
| Redirect standard output to a file |
command > file |
command > file |
| Redirect standard output and errors to a file |
command > file 2>&1
|
command > file 2>&1
|
| Create an alias |
alias m='more'
|
alias m='more'
|
| Remove an alias |
unalias m |
unalias m |
| List command history |
history |
history |
| Reexecute the previous command |
r |
!! (or press up arrow key) |
| Reexecute the previous command changing ab to xy |
r ab=xy |
(Press up arrow and edit command) |
| Reexecute the fifth command in the history list |
r 5 |
!5 |
| Reexecute the last command that started with vi |
r vi |
!vi |
| Define a function |
function fun { commands }
|
function fun { commands } export -f fun
|
| Execute a function |
fun |
fun |
| Delete a function |
unset -f fun |
unset -f fun |
| Represents home directory of current user |
~ |
~ |
| Represents home directory of user jsmith |
~jsmith |
~jsmith |
| Represents current working directory |
. (period) or ~+
|
. (period) or ~+
|
| Represents previous working directory |
~- |
~- |
| Compile a C++ program |
g++ prog.cpp |
g++ prog.cpp |
| Compile a C++ program for use with debugger |
g++ -g prog.cpp |
g++ -g prog.cpp |
| Complete a partial filename |
Press [Esc] then \ |
Press [Tab] |
For those who write shell scripts, there are several differences between ksh and bash. You will need more information to be
able to write shell scripts with bash.
You can customize your bgunix working environment by adding lines to the .bash_profile file found in your home directory.
This is an invisible file, so you won't see it with the ls command unless you say "ls -a". However, you must be very careful
when making changes to this file since errors in this file could prevent you from logging onto the system. Here are some sample
lines you could add to this file:
If you make changes to .bash-profile, be sure that you don't delete any lines that are already there.