ATTENTION PLEASE SET YOUR BASH SHELL NOW

At present your shell is set to the tom-C-shell or commonly known as the tomshell. We need to set the bash shell as your default shell. To do that you the user will have to access your user cgi_bin account by clicking on this link
Enter your net-id and password and then select the bash shell from the drop down menu. It will take a day to reset it to your bash shell. For lesson 1 in the shell prompt type
  • <prompt> bash <enter>
this will set the bash shell as the sub-shell undeneath the tomshell.

BASIC UNIX COMMANDS TO GET STARTED

What is a shell? How to rename or physically move a
  • file
  • directory
How to list contents of a directory
How to copy and move a
  • file
  • directory
How to move from one directory to another
How to use the remove command on
  • files
  • directories
How to make a directory



INTRODUCTION

It is important that you follow the rules laid out by Nicholas Crist or Rob Harris regarding the conduct in the lab (no food or drinks allowed in the lab!) and how to approach the tasks delegated to you in the course of the semester. The rules and guidelines have been laid out to help you maximize your efficiency and proficiency in the Linux environment. These instructions should be followed without question and any deviation from the norm will result in a one way trip to mediocrity. Due to the varying class sizes and the encumbering work load in teaching this class it is important that  you work with the instructor.
Every lab will start with exercises or drills that you have to complete from start to finish so that you get comfortable with the command line and the "all powerful Shell". The more comfortable you get with the environment the better you will fare in the projects and future classes. Perform the drills and be curious enough to explore the options. Practice is essential for success in this class. The more time you spend in the lab more efficient and comfortable you will be in the environment. At first your progress will be slow and you will feel daunted with the task ahead of you, but rest assured with the help of your instructors and your keen enthusiasm to learn you will prevail! After all, your very instructors once took this class with the recalcitrant-resolute-ominous Ash!


SYMBOLS AND KEYS USED IN THIS MANUAL

<bash>
this is your command prompt on the left hand corner of your shell. We will use this generic symbol to represent the command prompt
<enter>
depress the enter key
<ESC>
The escape key on your keyboard
<CTRL>
The control key on your keyboard
<CTRL-C>
Depress the control key and the letter C key on your keyboard
<CTRL-Z>
Depress the control key and the letter Z key on your keyboard
<CTRL-D>
Depress the control key and the letter D key on your keyboard
<SHIFT>
The shift key on your keyboard
<ESC><SHIFT>:
Press the ESC key and then the shift ; keys to get the :
dir
short for directory
~
the tilde symbol represents your home/joeusr dir
$HOME
Environment Variable that represents your /home/joeusr dir
home
Generic term used verbally that represents /home/joeusr ( home dir)
$USER
Environment variable that represents the user that is currently logged in
joeusr
Short and general userbame that represents a user i.e. you the student in aero 361
viper
Username of the author of the aero361 website
/usr
/usr is a directory so try not to get confused!
$PATH
the PATH variable
"path"
in reference to the directory location
scratch
in reference to /remote/scratch/joeusr
afshome
in reference to /afshome/joeusr
build
To compile and link a group of source codes to create the executable code.x
man [command]
Refers to the man pages for command manual e.g., man ls
pwd
unix command short for present working directory.
SPECIAL cp command
There will come a time when the user will need to copy a file or directory that is either in some locker or system directory, but the copy command may not work form these directories. Suppose the user wants to copy the file.dat file from /usr/local/dir directory. The user does not have to go to /usr/local/dir to copy file.dat over to the user's dir. The user can simply execute the following command from within the user's directory structure and snatch a copy of the file over
  • <bash> cp -r /usr/local/dir/file.dat .
The "period" at the end of the command path tells the shell to copy the file over to the directory from where the command was issued

BASIC UNIX COMMAND TO START A PROJECT

All unix commands are to be executed through the shell. The shell is the common interface to the kernel.  Depending on the system there can exist a varying number of shell languages. The common Linux shell language is "bash" which stands for "Bourne again shell". The Bourne shell became the popular shell in the linux systems replacing the common "tom shell" which was common to Unix systems running on the RISC processors. However, the "tom shell" is still maintained in the linux Os along with "Korn shell", "C shell", "Z shell" and "Ash shell". The "C shell" was the precursor to the "Tom shell" while the others are more modern shells. The shell language or shell you will be using will be the "bash" shell. But there may come a time when you may have to check which shell is running on the machine. The table below will show you how to check which is the parent shell and how to invoke child shell inside the parent shell.

command
description
<bash> ps
the ps command will show the user which is the parent shell
<bash> tcsh
now you have created a tom shell inside the bash shell. The tom shell is the child of the parent bash shell on this konsole
<bash> ps
the ps command will show you that there is bash shell on top of a tom shell
<bash>exit
the tom shell will terminate and you will be back to the bash shell.

ls command

Command
Description
Description
<bash> cd
go straight to your /home/joeusr directory

<bash> cd ~
go straight to your /home/joeusr directory. The "~" sign is a symbol that represents your /home/joeusr directory.

<bash> ls
lists all files in the current directory

<bash> ls -a
<bash> ls -a .kde/
<bash> ls -a .mozilla/
<bash> ls -a .bash_profile
<bash> ls -a .bashrc
lists all types of files in the current directory including startup files. A startup file in one that starts with a "." Every time a user uses an application a startup file or directory is created. In order to list them the -a flag needs to be used
use this command to list startup files. If ever you down load these files to your $HOME make sure you put the . before the name i.e. .bashrc
  • .bashrc
  • .bash_profile
  • .bash_history
  • .vimrc
  • .idbrc
  • .mozilla/ dir
  • .kde/ dir
<bash>ls -F
appends a symbol to the type of item in the current directory. Directories listed will have a / appended to them while executables will have a * appended to them
use this command to differentiate between a directory and a file
<bash>ls -F --color=auto
adds color and symbol to the items in the current directory

<bash> ls -R
lists directories recursively

<bash> ls -F --color=auto /remote/scratch/viper
list the contents of the directory /remote/scratch/viper

<bash> clear
the clear command will clear the screen
good tool to use often
<bash> man ls
use the man page to see the manual on the ls command
When in doubt use the man pages

CHANGE DIRECTOR: cd COMMAND

Command
Description
<bash> cd
go straight to your /home/joeusr directory
<bash> cd ~
go straight to your /home/joeusr directory
<bash> cd ..
go back/up one directory
<bash> cd /remote/scratch/viper
go to /remote/scratch/viper
<bash>cd ../../
go back/up 2 directories
<bash>cd ../../../
go back/up 3 directories
<bash>cd $HOME
go to your home directory
<bash> pwd
check what is your present working directory
<bash> cd /remote/scratch/viper
<bash> pwd
<bash> cd /remote/aere/joeusr ; pwd
<bash> cd /afshome/joeusr ; pwd
  • go to /remote/scratch/viper and check if you are there using the pwd command.
  • do the same replacing viper with your username. Remember joeusr is an general name that should be replaced with your username.
<bash> cd /remote/aere/joeusr ; pwd
<bash> cd /afshome/joeusr ; pwd ; ls
cd into the /remote/aere/joeusr directory under your username. This directory is not backed up but contains a lot of space and you can dump large files here. Notice that the command continues with a ";" and then pwd. The semi-colon is a command separator: its the same as executing the 1st command and then executing the second command.
In the second example you will cd into the hdrive. You can check out the contents. This will come in handy. Your acropolis account is mounted on the linux machines when you login.

MAKING DIRECTORIES AND MOVING AROUND: mkdir [name]

Command
Description
<bash> cd
go straight to your /home/joeusr directory
<bash> pwd
make sure you are at /home/joeusr. Your home dir
<bash> mkdir aero361
make a main directory called aero361
<bash> cd aero361
cd into aero361
<bash>mkdir labs
create a directory called labs in aero361
<bash>cd labs
enter the labs/ dir
<bash> mkdir lab1
create a directory called lab1 in labs1
<bash> cd lab1
enter lab1
<bash> mkdir src bin dat report
create 4 specific subdirectories in lab1
<bash> cd src
go into the src/ dir
<bash> touch main.f90 input.f90 output.f90 solver.f90
create 4 specific empty files in src
<bash> cd ../report
cd back/up one dir and into report
<bash> touch main.tex intro.tex theory.tex results.tex conclusion.tex
create 4 specific LaTex files in report

MOVE & COPY

/home/joeusr

aero361/

labs

lab1


src/     dat/       bin/  report/
/home/joeusr

aero361/

labs

lab2


src/     dat/       bin/  report/

Command
Description
<bash> cd
go straight to your /home/joeusr directory
<bash> pwd
make sure you are at /home/joeusr. Your home dir
<bash> cd aero361/labs go to the labs directory
<bash> ls -F
you should see a lab1 directory in the shell list
<bash>mv lab1 lab2
rename lab1 as lab2
<bash>cp -r lab2 lab1
copy lab2 and its contents and create lab1 since you need lab1. The -r option is for recursive and allows the copying of directories and their contents. You cannot copy a directory without the -r flag
<bash> pwd
you should still be in labs/ dir and not any of its sub directories
<bash> cd lab1
enter lab1
<bash> cd src
go into the src/ dir
<bash> mv main.f90 ../
physically move main.f90 out of src and into lab1. This mv command with the ../ will physically move the main.f90 file up one directory
<bash> ls ../
Remain in src/ and list the contents of lab1 since it is one above src. You should see main.f90. You should still be in src/ dir!
SPECIAL mv command

<bash> mv ../main.f90 .
Remain in src/ and move main.f90 back from the above directory and into the src/ dir where your prompt is currently located. To do this "fetch" type or pull type move you need the period at the end of the command following a space
  • move [path]/file .
In this type of mv operation you move a file or directory back to where you are currently located. You or your prompt should be in src/ dir of  lab1 without leaving this directory you are moving a file back to where you are located. To do this operation you need the "." at the end of the command, where the "." signifies your current location.
SPECIAL cp command

<bash> cp ../report/main.tex .
Now cp the same way as the move in the above step except copy the file main.tex from the report/ dir
<bash> cd ~
<bash> cp /lockers/aero170/aero361/vim/vimrc  .vimrc
<bas>> ls -a .vimrc
cd back to $HOME. Now snatch the vimrc startup file from some directory in the aero361 lockers dir and place it in your $HOME as .vimrc
In this example you copied the file "vimrc" from some directory location and renamed it as .vimrc in your $HOME
<bash> cd ~
<bash> cp /lockers/aero170/aero361/idbrc/idbrc .idbrc
<bash> ls -a .idbrc
make sure that your are in $HOME. Do the same as you did in the above exercise but now snatch the idbrc startup file and call it .idbrc. All these startup file will reside in $HOME


REMOVING FILES AND DIRECTORIES: rm [-flags]

/home/joeusr

aero361/

labs

lab1


src/     dat/       bin/  report/
Command
Description
<bash> cd
go straight to your /home/joeusr directory
<bash> pwd
make sure you are at /home/joeusr. Your home dir
<bash> cd aero361/labs go to the labs directory
<bash> ls -F
you should see a lab1 and lab2 directory in the shell list
<bash> rm -rf lab2
remove directory lab2 and its contents
  • -r flag is for recursive removes the directory and its contents
  • -f flag is for force
<bash>cd lab1/src
cd into the src dir
<bash> rm -i main.tex
remove the file main.tex it does not belong here
  • -i flag invokes a question answer yes
NOTE: Always use the -i flag when removing items. Later on we will create an alias for it so that you do not need to keep typing the flags, but for now use -i flag (please!!!!)


How to start a Project in f90