The RTDC
Processing SMA Data
1.2 m Telescopes
AST/RO
Extra

Basic shell commands


Find out what directory you are in
pwd
List what is in the current directory (-l for extra info/-h for readable filesizes)
ls -lh
List all files including normally hidden system ones
ls -a
List only files ending in .log
ls *.log
Make a new directory called data
mkdir data
Move into the directory called data
cd data
Move back up the tree out of the data directory
cd ..
Go to your home directory
cd ~
Rename file1 to file2
mv file1 file2
Make a copy of file1 called file1.bak
cp file1 file1.bak
Move file1 into the data directory
mv file1 data
Remove a file
rm file1
Remove a directory
rm -r data
Print a text file to the screen
cat file1
Print a text file to the screen so it is scrollable
less file1        (q to exit out of less)
or
more file1
Log on to a different machine (host2) on the same network
ssh user@host2
Check which machine you are on
hostname
Check what processes are running
top        (q to exit out of top)
List previous commands you've used
history
Look up a command in the manual
man command
Change your password (on the server)
yppasswd
Check which shell you are using (default is tcsh)
echo $0
Switch to a bash shell
bash
Redirect the output of a command (ls here) to a new file
ls *txt > list.txt
Append an existing file with the output of a command
ls *log >> list.txt
View a png file
display file.png
View a pdf file
evince file.pdf
Search for the phrase 2.0 Jy in all files in the current directory
grep -s '2.0 Jy' *
Tar a file or directory
tar -cvf backup.tar directory
Untar a tar file
tar -xvf backup.tar

CENTER FOR ASTROPHYSICS | HARVARD & SMITHSONIAN
60 GARDEN STREET, CAMBRIDGE, MA 02138