150 likes | 263 Vues
Join us at the Wharton Summer Tech Camp for an engaging session on Basic UNIX commands and functions. Learn about the history and evolution of UNIX, including its development at AT&T Bell Labs and its influence on modern operating systems like Linux and macOS. Gain hands-on experience with essential commands for directory navigation, file manipulation, and process control. Whether you're a beginner or looking to refresh your skills, this session will provide valuable insights into using the UNIX shell effectively. Get ready to enhance your technical toolkit!
E N D
Session 2Wharton Summer Tech Camp Basic Unix
Agenda • Cover basic UNIX commands and useful functions
UNIX • Operating System • AT&T – Bell Lab 1969 • Ken Thompson, Dennis Ritchie, Brian Kernighan, etc(picture: Ken Thompson and Dennis Ritchie standing) • Linux, Mac OSX descended from Unix • For Windows, Unix-like environment can be achieved by • Just Logging into Unix.wharton.upenn.edu OR • Install cygwinwww.cygwin.com/
Unix Prompt • [leedok@hpc-login2 ~]$ Current Directory name (~ means home) user name network node hostname
Unix Shell • Unix Shell: A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems. (WIKI) • Basically, a translator between unix OS (kernel) and user, delivering commands. • There are many varieties: bash, tcsh, csh, ksh • Bash is the most popular
Information look up • Manual page: “man [command]” “man man” • Google everything! • Stackoverflow.com
Command Structure • [Command] [Options] [Argument] • ls –l directory • Directory structure separated by “/” • /home/opim/leedok • Important Startup File: ~/.bash_profile Directory name. By default, if you don’t specify, it’s current working directory “.” Command for listing directory contents Command for listing directory contents
Control-key commands • ctrl-c • interrupts a runningprogram • ctrl-z • suspends a running program • (use the fg command to continue the program)
Directory Navigation • ls - list content of a directory • pwd– print working directory • cd – change directory • mv– move file or rename • cp - create a copy of a file • rm– remove a file • mkdir– create a new directory • rmdir– remove a directory
Some other commands • who - list who is on system • echo, printf– display a message • script- log all interaction in a file • clear- clear the screen • cat, more, less – file perusal • du – file info • chmod– change permission • find: • By Name: find . –name \*.ado • By Type: find . –type d (directory) • Etc
Pipes and Redirects • > - Redirect output from a command to a file on disk. • >> - Append output from a command to an existing file on disk. • < - Read a command's input from a disk file, rather than the user. • | - Pass the output of one command to another for further processing. • Date > date.txt • Date >> date.txt • who | cut -f1 -d" " | sort -u
Bit more advanced commands • grep – match string patterns (search) • sed, awk– find and replace (text manipulation)
Lab session • Do some exercise posted “practice.sh” • Do Unix tutorial if you are new to it http://www.ee.surrey.ac.uk/Teaching/Unix/ 1: Log into unix account if you have one Sshuname@unix.wharton.upenn.edu 2: If you have Mac OS, just open up the “Terminal” 3: If you have Linux, you probably know this 4: if you have Windows, download terminal applications (e.g., putty, secureCRTetc)
For the next session • Download and install Canopy – packaged python • https://www.enthought.com/products/canopy/academic/ • People with EDU email gets it for free