Linux Shell
Linux Shell
Basic level
/lost+found When your system crashes, this is the place where you will get your files.
Mostly the file(s) stored in this directory changes their size i.e. variable data files. Data files including spool
/var
directories and files, administrative and logging data, and transient and temporary files etc.
Central location for all your application program, x-windows, man pages, documents etc are here. Programs
meant to be used and shared by all of the users on the system. Some of the important sub-directories are as
follows:
bin - sub-directory contains executables
/usr
sbin - sub-directory contains files for system administration i.e. binaries
include - sub-contains C header files
share - sub-contains contains files that aren't architecture-specific like documents, wallpaper etc.
X11R6 - sub-contains X Window System
All shared library files are stored here. This libraries are needed to execute the executable files (binary) files in
/lib
/bin or /sbin.
/tmp Temporary file location
/dev Special Device files are store here. For e.g. Keyboard, mouse, console, hard-disk, cdrom etc device files are here.
Floppy disk, CD-Rom disk, Other MS-DOS/Windows partition mounted in this location (mount points) i.e.
/mnt
temporarily mounted file systems are here.
/boot Linux Kernel directory
/opt Use to store large software applications like star office.
/proc This directory contains special files which interact with kernel.
Secure connections and transfers
` Connections:
` ssh 156.111.6.184
ssh –X magali@156.111.6.184
` transfers:
` sftp magali@156.111.6.184, then put/get
` scp (-r) files machine:path
scp *.pam 156.111.6.184:/usr10/magali
` Example: connect and transfer files on the master node of the cluster
` Connect with ssh -X magali@156.111.6.1977
` Check the disk space:
/home/magali> df -h ./
Filesystem Size Used Avail Use% Mounted on
/dev/sdc1 2.2T 1.3T 985G 56% /master.raid
` Check the space usage of your files:
magali/Master_cluster> du -hs ctftilt
262M ctftilt
` Transfer files from the cluster to your computer:
scp –r Xlk 156.111.6.46:/space
` Note: to log on a node from the master node:
% rsh node42
Miscellaneous
` whoami --- returns your username. Sounds useless, but isn't. You may need to find
out who it is who forgot to log out somewhere
` date --- shows the current date and time.
` Archiving: tar
` tar –cvf myarchive.tar *.pam
` tar –cvzf myarchive.tar.gz *.pam
` tar –xvf myarchive.tar
` tar –xvzf myarchive.tar.gz
` File Compression:
` gzip filename --- Produces filename.gz
` gunzip filename --- uncompresses files compressed by gzip.
` compress/uncompress: .Z format
` zip/unzip: .zip format
` Syntax:
command1 | command2
` Examples:
` ls | more
` ps –ef | grep spider
Control structures (if)
` The C shell has control structures similar to the C programming language.
These are foreach, if, switch and while. These are usually used in shell scripts
` if (condition) simple command
` if (condition)
then
commands
…
fi
` if (condition)
then
commands
…
else
commands
…
fi
` You can have nested if-else-fi
Loops
` while:
while (expr)
command(s)
end
` foreach:
foreach var (wordlist)
command(s)
end
` label:
label
…
goto label
Interfacing SPIDER and C shell
Command VM in SPIDER
Ex:
; ----------- Input files --------------
FR L
[selection_file]../2-selection_on_visual ; Selection doc file
FR L
[MRC_mic]../Micrographs_MRC/Xlk{*****[mic]} ; Input MRC images
UD N [max]
[selection_file]
DO [i]=4041,[max]
UD [i],[mic]
[selection_file]
; ctftilt options:
; Input image file name
; Output diagnostic file name
; CS[mm], HT[kV], AmpCnst, XMAG, DStep[um], PAve:2.26,300.0,0.1,100000.0,15.0,2
; Positive defocus values for underfocus
; Box, ResMin[A], ResMax[A], dFMin[A], dFMax[A], FStep: 128,200.0,6.0,9000.0,50000.0,500.0
VM
rm mic.pow
EN D