BASIC UNIX COMMANDS TO GET STARTED
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
INTRODUCTIONIt 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!
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. |
| 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
|
| <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 |
| 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 |
|
| <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. |
| 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 |
/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
|
| <bash>cd
lab1/src |
cd into the src dir |
| <bash>
rm -i main.tex |
remove the file
main.tex it does not belong here
|