Using the Bash Shell (Bash) BGLinux

Question

What information is available on using the Bash Shell (Bash) BGLinux?

Answer

The Following Table describes some common Linux commands and features. 

Command or feature bash (new bglinux)
Commands executed when logging in

.bash_profile

Commands executed with each process .bashrc
Display the contents of a file on the screen cat
Return to the login directory cd
Change default directory to directory-name cd directory-name
Clear the terminal screen clear
Copy file source to dest cp source dest
Interrupt the execution of the current program [Control]-c
Log off the system exit or [Control]-d
List files waiting to be printed lpq
Send a file to the printer cslpr filename
Lists the files in the current directory ls
Lists the files in the current directory, with more info. ls -l
Create a subdirectory called dir-name mkdir dir-name
Display information about a linuxcommand man command
View a file one page at a time more filename
Rename a file mv old-name new-name
Change your password passwd
Save a session in a photo file photo log-file-name
Create or edit a file vi filename or
pico filename
Display the current default directory pwd
Delete (remove) a file rm filename
Delete (remove) an empty directory rmdir dirname
Redirect standard output to a file command > file
Redirect standard output and errors to a file command > file 2>&1
Create an alias alias m='more'
Remove an alias unalias m
List command history history
Reexecute the previous command !! (or press up arrow key)
Reexecute the previous command changing ab to xy (Press up arrow and edit command)
Reexecute the fifth command in the history list !5
Reexecute the last command that started with vi !vi
Define a function

function fun {
commands
}
export -f fun

Execute a function fun
Delete a function unset -f fun
Represents home directory of current user ~
Represents home directory of user jsmith ~jsmith
Represents current working directory . (period) or ~+
Represents previous working directory ~-
Compile a C++ program g++ prog.cpp
Compile a C++ program for use with debugger g++ -g prog.cpp
Complete a partial filename Press [Tab]

 

For those who write shell scripts, there are several differences between ksh and bash.  You will need more informatuion to be able to write shell scripts with bash. 

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 "Is" commands unless you say "Is-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.

For additional assistance, please contact Information Technology Services at 419-372-0999 or through chat.

Details

Article ID: 7207
Created
Thu 6/25/15 1:45 PM
Modified
Fri 6/19/20 2:28 PM