Beruflich Dokumente
Kultur Dokumente
2010
FSG
Accenture
Email: Subrat.Rout@accenture.com
Outline
Introduction to UNIX
Text Editor - NANO
Basic Commands
File Manipulation
Permissions
Processes
Important Utilities
Running a Program
Remote Login Procedures
Copyright 2008 Accenture All
Rights Reserved.
Introduction to UNIX
What is UNIX?
UNIX is an operating system (OS) and
set of related utility programs
It is the manager of everything going on in your computer
Advantages of UNIX:
Many Users can use the same computer at the same time
Can run many different things simultaneously
Shell:
The program you use to interact with the computer
File:
Stored info and all your devices (like disk drives and printers)
Processes:
All Programs that running
Rules for Names:
Case Sensitive (ie. Happy.txt is different than happy.txt)
Extensions Irrelevant (for now)
Copyright 2008 Accenture All
Rights Reserved.
Format of Commands
General Format of Commands:
The command line:
[cswug@machine1 cswug]$
The command structure:
[ ]$ command options arguments
Exercise: Files
Make 2 copies of your unix.notes with cp (call the copies
unix2.notes and unix3.notes)
Rename the unix2.notes to unix4.notes with mv
Make sure you have 3 files with ls
Remove the unix4.notes copy with rm
File Contents
less - displays file contents
less file1
head - displays first 10 lines of file
head file1
tail - displays last 10 lines of file
tail file1
grep - search file for given pattern
grep pattern file1
diff - compares 2 files and tells if different
diff file1 file2
Copyright 2008 Accenture All
Rights Reserved.
Other Commands
man - short manual on command
man command
learn - tutorial on how to use certain topics
learn
df
df
Intro to Directories
Using Directories
cd - changes directories
cd directoryname
pwd - display current path
pwd
mkdir
- make new directory
mkdir newdirectory
rmdir - delete directory (requires that dir is empty)
rmdir olddirectory
Exercise: Directories
Check current path with pwd
Make a new directory with mkdir called unix/
Change into that directory (cd) and make another directory
called notes/
Delete the notes/ directory with rmdir
Go back to home directory with cd ~ or cd ..
Move (mv) your unix.notes from here to your new folder
unix/
Copyright 2008 Accenture All
Rights Reserved.
Changing Permissions
Chmod
-changes the permissions on a file
chmod [options] who [operation][permission] file-list
who
operation
permission
Examples:
chmod a +r file1
chmod g -wx file2
chown
-changes owner of a file
chown newowner file
Copyright 2008 Accenture All
Rights Reserved.
User Accounts
su
-switch user (or super-user)
su newperson
useradd
-adds new user
useradd newperson
userdel
-deletes user account
userdel oldaccount
Processes
top
- lists processes currently running (and get IDs)
top
(type q to get out of listing)
ps
- lists status of a process
ps idnumber
kill
- kills a process
kill idnumber
killall
killall
Important Utilities
gzip
gzip file1
gunzip
- unzips a file
gunzip file1.gz
tar
- clumps all files into archive
tar -cvf archivename filelist
-creates an archive
tar -xvf archivename
-extracts files from archive
Running Programs
Compiling a Program:
Note: For the compiler, the extension (.c or .f90) DOES matter!
gcc
- C compiler
gcc mainfile.c
ifort
- Fortran compiler
ifort file.f90
(The default name of a created program is a.out)
Executing a Program
./
- Runs a compiled program
./a.out
Remote Login
Thanks!
References:
Sobell, Mark G. A Practical Guide to Unix
System V - 2nd ed.
Nomura, Ken-ichi. Tutorial of UNIX/LINUX
@ CSWUG 2004
Sharma, Ashish. General Reference
Questions?