We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Modified over 5 years ago
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
© Acknowledgements Ohio Supercomputing Centre (OSC) Basic & Intermediate UNIX courses http://www.osc.edu/hpc/training/bunix/ http://www.osc.edu/hpc/training/iunix/ With exercises: http://www.ee.surrey.ac.uk/Teaching/Unix/ Further references Google http://en.wikipedia.org/wiki/Unix
© Shells Programs Java Library Kernel UNIX and its history Its an Operating System Liaison between the user (you) and the computer Been around since the 70s Rejuvenated in the 90s with Linux Traditionally high-end machines Through Linux available nearly everywhere Programs work through a library Compositional & layered Hardware
© Everything is a process A process is the ‘unit’ of work in Unix A process is owned by a particular user Each user owns its own processes (partitioning) Cannot interfere with another user’s process ‘root’ is the admin or super user It can interfere with all processes Processes come from other processes They are ‘spawned’ or ‘forked’
© The machine in front of you It is up and running and with a login screen Login in using your username & password You will be presented with a ‘desktop’ Growing similarity to Windows desktop Usability is one of the major Linux improvements Your interaction with the machine through a terminal Start one up by navigating through the menu
© The Terminal (xterm) This window represents a ‘shell’ session What is a shell? A way of interacting with the computer Allows you to enter (& execute) commands By default you are in the Bash shell There are several different flavours of shells Over-time you may develop a preference Not a concern now
© Notation (& try out the examples) Typing a command into your terminal: $ ls $ represents the ‘prompt’ in your shell ls is the command you want to run (followed by ENTER) A command may have options prefixed by ‘ - ’ or ‘--’ $ ls –al The ls command lists directory contents Some commands have ‘arguments’ $ ls
© Self Help Unix has many different commands Different commands (applications) in a distribution Different shells have different build in commands Finding out about different commands apropos – simple search engine for manual pages man - display the command’s manual page -help or --help : show the built in help text
© What processes are running? To see the currently running processes: List the processes that you are running $ ps List the processes running on the machine $ ps –e $ ps -ef To see an updated list of processes $ top Press q to quit
© Exercise: Find out which shell you are in Get you shell to tell you about its environment $ env Displays a list of environment variables Each variable has a name & value One of these variables is the SHELL variable SHELL=/bin/bash To display a specific value use the echo command: $ echo $SHELL /bin/bash [is the screen output]
© File Hierarchy
© Useful Directory Commands pwd : Tells you where you are in the directory space cd : Change directory cd ~ : Change to your home (initial) directory cd /home/users/sn : Change to an absolute directory location cd../sn : Change to a relative directory location (up a level and then into the sn directory) You will have a different username than sn
© Other Useful Directory Commands mkdir - Create a directory rmdir - Remove a directory
© Manipulating files Copy a single file (after creating it: $ touch testfile1 ) $ cp testfile1 testfile2 Copy a directory (after creating it: $ mkdir testdir1 ) $ cp –pr testdir1 testdir2 Move a single file or directory (sort of rename) $ mv testfile2 testfile3 Delete a single file $ rm testfile1 HINT: Use ls to examine how the directory has changed after each command
© Exercise: Download a set of files Using a browser: Easy point & click – NO Using commands executed from the shell 1. Goto your home directory ( cd ) 2. Create a new sub-directory ( mkdir ) 3. Move into the subdirectory ( cd ) 4. Retrieve the file archive from the web ( wget ) 5. Expand the file archive ( tar ) 6. Look at what we’ve got ( ls )
© New Commands wget : Retrieve http or ftp based URLs into the current directory (Web Get) tar : Tape Archive (very old command!) User to build or extract file & directory hierarchy from an archive Examine the contents: $ tar --list –zvf How would you extract the contents instead of list? HINT: You may want to see what HELP you can get
© And the finally…. The file archive is: http://www.ecs.soton.ac.uk/~sn/gs06.tar.gz Examine the extensions:.tar – Tells you it’s a tar archive.gz – Tells you it compressed with gzip.tar.gz is frequently abbreviated to.tgz People can lie… and then the commands will normally complain
© Examine the download You have a directory ( bin ) with a file & a file bin/gridschool longfile.txt Examine the contents of the longfile.txt using various commands more : Allows you to control how much text goes past. A page at a time by pressing space, or a line at a time by pressing return. $ more longfile.txt less : Similar to more but allows you to go backward (b key) as well as forward (space) $ less longfile.txt
© Examine explicit parts of a file head : Examine the start of a text file (or just the first 5 lines) $ head longfile.txt $ head -5 longfile.txt tail : Examine the end of a text file (or just the last 5 lines) $ tail longfile.txt $ tail -5 longfile.txt grep : Look for lines with specific text $ grep HEAD logfile.txt $ grep GET longfile.txt | more $ cat longfile.txt | grep GET | more Combine commands together by ‘piping’ cat : Dumps contents to the screen
© Using your commands Recap on commands: Built in to the shell Standalone executable applications Standalone commands are in ‘well-known’ locations How do you find out where a command is located? $ which echo $ which export How does the shell know where to look…?
© Finding an executable The PATH variable tells the shell which directories to look in for an executable Directories separated by ‘:’ How do we find the value of the PATH variable $ echo $PATH $ env How do we change the value: BASH: export PATH=
© Add in our own executable Find the absolute location of the ‘bin’ directory in the download HINT: Navigate to the directory using: cd to move into and out of directories ls to examine the contents of the directory HINT: Once you are in the bin directory use the pwd command to find out its absolute path. Add this directory to the PATH variable (one line) $ export PATH=$PATH:/home/users/sn/download/bin:
© Verifying this has worked Check the executable is there $ which gridschool It will tell you the full absolute path Run the command $ gridschool Expected output: Welcome user sn to ISSGC06
© Editors Very simple: vi http://unixhelp.ed.ac.uk/vi/index.html WYSIWYG: nedit More ‘normal’ editor
© Thank you… Questions?
Linux commands exercise 1. What do you need, if you try to these at home? You need to download and install Ubuntu Linux from the Internet – DVD is need.
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux+ Guide to Linux Certification, Second Edition
Lecture 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
“Linux at the Command Line” Don Johnson of BU IS&T.
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Linux Shell. 2 Linux Command-Line Interface ■ Linux shells: A shell is a command interpreter that allows you to type commands from the keyboard to interact.
Linux Commands LINUX COMMANDS.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Brief introduction to UNIX A. Emerson CINECA, High Performance Systems.
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.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
© 2021 SlidePlayer.com Inc. All rights reserved.