C tutorial (language, compilation and debugging)

Download Report

Transcript C tutorial (language, compilation and debugging)

Help session:
Unix basics
Keith
9/9/2011
Login in Unix lab
 User name: ug0xx
Password: ece321 (initial)
 The password will not be displayed on
the screen.
 Open the console program to input
commands
 use command 'passwd' to change your
password
 Make sure to change the password!
Remotely connect to Unix and
file transfer
 Install Secure Shell Clients and X-Win32
available at: http://softweb.cc.sunysb.edu/
 Use ssh with the assigned account to remotely
connect to the unix server. If a graphic interface
is needed, check the “Tunnel X11 connections”
option in the tunneling tab and open x-win on
your local computer.
 Use ssh file transfer client or ftp to transfer files
to or from unix server (cyclops.ee.sunysb.edu).
Directory structure
 Tree-like directory structure.
 The root directory is /.
 Every user has a private working
directory with full permission.
 When you login, you're under your
working directory.
 Absolute path and relative path
A: /home/home2/ug001/
R: ./
permissions
 Read / Write / Execute
 View permissions
ls -l /directory/file
-rwxr--r-- 1 owner group ...
(7 4 4)
 Set permissions (Owner only)
chmod 700 /directory/file
Commands
 cd: change working directory
cd
go to $HOME directory
cd ..
go to parent directory
cd go to previous directory
 ls: list contents of the directory



-a do not hide entries starting with .
-l use a long listing format
-t sort by modification time
 mkdir: create a directory
Commands
 cp: copy files
 mv: move files
 rm: remove files


Files will be permanently removed
-i prompt before any removal
 touch: change file timestamps, can be
used to create a dummy file
 cat: concatenate and display files
Search Commands
 grep: text search
 Basic usage: grep ‘pattern’ file
 Regular expression: describe complex
patterns in texts
 An example, pattern for email address
‘\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b’
 find: search for files
Search in the current directory and all sub
directories: find . -name “filename"
Commands
 tar: store and extract files from an archive, can
also compress or decompress an archive.
 .tar


tar xvf FileName.tar
tar cvf FileName.tar DirName
 .tar.gz


tar zxvf FileName.tar.gz
tar zcvf FileName.tar.gz DirName
 man: display the online manual pages
Text editor: vi








vi or vi filename to start editor
command mode and input mode
enter input mode: a or i
‘Esc’ to command mode
delete: x (single character) dd (a line)
number for repeating action
u for undo
exit editor



:wq (save and exit)
:q! (exit without saving)
q (exit, maynot work)
For more information
 TA’s webpage:
http://www.ic.sunysb.edu/stu/xdeng
 Search on the Internet
 Office hour