Using BGLinux

Most computer science classes use a system called bglinux. However, before using bglinux for computer science classwork, you need to execute the following command:

cs-config

This command will set up the environment for your use in computer science classes. After you execute this command and log in again, your command prompt will show your current default directory (where ~ signifies your login directory). The following are descriptions of some common Unix commands and features.

CommandDescription
catDisplay the contents of a file on the screen
cdReturn to the login directory
cd directory-nameChange default directory to directory-name
clearClear the terminal screen
cp source destCopy file source to dest
[Control]-cInterrupt the execution of the current program
exit or [Control]-dLog off the system
lpqList files waiting to be printed
cslpr filenameSend a file to the printer
lsLists the files in the current directory
ls -lLists the files in the current directory, with more info.
mkdir dir-nameCreate a subdirectory called dir-name
man commandDisplay information about a unix command
more filenameView a file one page at a time
mv old-name new-nameRename a file
passwdChange your password
photo log-file-nameSave a session in a photo file
vi filename or
pico filename
Create or edit a file
pwdDisplay the current default directory
rm filenameDelete (remove) a file
rmdir dirnameDelete (remove) an empty directory
command < fileRead standard input from a file
command > fileRedirect standard output to a file
command > file 2>&1Redirect standard output and errors to a file
alias m='more'Create an alias
unalias mRemove an alias
historyList command history
!!Reexecute the previous command
[Press up-arrow key]Reexecute the previous command
!5Reexecute the fifth command in the history list
!viReexecute the last command that started with vi
function fun {
   commands
}
export -f fun
Define a function
funExecute a function
class -join cs123rlJoin class cs123rl
dropclass cs123rlRemove yourself from class cs123rl
g++ prog.cppCompile a C++ program
g++ -g prog.cppCompile a C++ program for use with debugger
File/directory referencesDescription
.bash_profileFile containing commands executed when logging in
~Represents home directory of current user
~jsmithRepresents home directory of user jsmith
. (period)
~+
Represents current working directory
~-Represents previous working directory

Use the [Tab] key to complete a partially-typed filename.

Customizing your bglinux environment

You can customize your bglinux 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:

export PS1="\u \w\$ "This command will show your username and the current directory in your command prompt. (There is a space after the 'u' and after the '$'.)
function ls {
   command ls -F $@
}
export -f ls
These four lines change the ls command so that the -F flag is always added. The -F flag adds / to the end of directory names and * to the end of executable filenames.

If you make changes to .bash_profile, be sure that you don't delete any lines that are already there.

Updated: 08/01/2018 06:38PM