Getting familiar with the UNIX environment here at PSU. - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

Getting familiar with the UNIX environment here at PSU.

Description:

Hack your code and run/debug your programs. Copy files to and fro ... Changing Your Password. The program to run (from a prompt) $ passwd ... – PowerPoint PPT presentation

Number of Views:70
Avg rating:3.0/5.0
Slides: 33
Provided by: webCe
Category:

less

Transcript and Presenter's Notes

Title: Getting familiar with the UNIX environment here at PSU.


1
An Introduction to UNIX
  • Getting familiar with the UNIX environment here
    at PSU.
  • Presented by Mr. Waddell

2
Follow Along
  • You can follow along with the demo by downloading
    these slides from the ACM club website.
  • http//www.acm.pdx.edu/presentations

3
Topics
  • Remote login
  • Setting up your environment
  • Basic commands
  • The directory tree
  • A few odds and ends

4
Remote Login
You can login to any of the CS UNIX and CS Linux
machines from the Internet.
  • Hack your code and run/debug your programs
  • Copy files to and fro

5
Remote Login
  • Windows
  • PuTTY is a Secure Shell (SSH) client.
  • Google for PuTTY
  • Snag PuTTY, as well as PSCP and PFTP.Linux
    Users
  • Hopefully you already know about ssh...

6
Remote Login
  • With your CS UNIX/Linux account username and
    password.
  • Hosts cs.pdx.edu (Sun Solaris, on
    SPARC) linuxlab.cs.pdx.edu (Linux, on
    x86) odin.pdx.edu (Sun Solaris, not maintained
    by the CECS department)
  • Pick your celestial body. i.e. atlas.cs.pdx.edu
    (Sun Solaris) tao.cs.pdx.edu (Linux)

7
Remote Login
  • PSFTP (or sftp on a UNIX machine) allows you to
    copy files back and forth from using an ftp-ish
    user interface.
  • PSCP (or scp on a UNIX machine) also allows you
    to copy files back and forth, but without the
    interface.

Note The UNIX (sftp, scp) utilities do not have
a graphical interfaces.
8
Some Basics
  • Your shell, and how to change it
  • Changing your password
  • Core utilities you should be familiar with

9
The Shell
  • Put down your mouse
  • Shell prompt terminal your friend
  • Enter commands and witness the results
  • Anything that you wish to do on a UNIX machine
    can be done with your shell prompt (mostly)
  • First Step Change your shell from csh!

10
Changing Your Shell
  • csh is oldschool
  • Not exactly as feature rich, as friendly, nor
    convenient as other shell programs
  • A better alternative is tcsh
  • Command history
  • Tab completion (of sorts)
  • More compatible with the configuration of the CS
    machines

11
Changing Your Shell
  • The program to run (from a prompt) chsh
  • It will prompt you for your password
  • Enter the shell you want to use instead.
    i.e. /bin/tcsh
  • Logout, and then back in. Note It may take a
    minute or two to propagate.

12
Changing Your Password
  • The program to run (from a prompt) passwd
  • It will ask you for your current password, then
    twice for your new password.
  • A good password consists letters numbers and
    perhaps other symbols (, -, , ...).

13
Core Utilities
  • The basic utilities you probably should know
    about.
  • ls (List contents of directories)
  • pwd (Displays your current location)
  • cd (Move around from place to place)
  • rm (Remove a file or directory)
  • mkdir (Make a directory)
  • cp (Copy files and directories)
  • mv (Move, or rename files and directories)

14
Core Utilities
  • More basic utilities
  • addpkg (Install software i.e. Java)
  • lpr (Print a document)
  • lprm (Remove your print job)
  • man (Displays documentation)

15
Man Pages
  • Most programs you will be using have a man page.
  • The format command OPTIONS arg1 arg2 ...
  • Do not include the actual square brackets
  • arg1 and arg2 are not optional
  • Forms of options (aka flags, aka arguments) -a
    where a is a single character (OR) --blah
    where blah is a single word

16
Man Pages
  • You can also invoke the program to tell you more.
    (i.e. displaying a usage description) command
    --help (OR) command -h

17
The UNIX File System
  • The file system (obviously not exhaustive)Note
    the top, naturally, is called root

/
usr
u
...
bin
...
your_username
...
18
The UNIX File System
  • Try this
  • cd /
  • ls

You are here
/
...
usr
u
19
Relative Paths
  • To get back home
  • cd u
  • cd your_username
  • ls

/
u
You are here
your_username
20
Relative Paths
  • Both times when cd was used cd u cd
    your_usernameyour target (u, and your_username)
    were contained in the directory you currently
    were in.
  • u is relative to root (/)
  • your_username is relative to u

21
The UNIX File System
  • Try this
  • cd /usr
  • ls

/
usr
You are here
bin
...
22
Absolute Paths
  • To get back home
  • cd /u/your_username
  • ls

/
u
You are here
your_username
23
Absolute Paths
  • This time neither u nor your_username were
    relative to where you currently were.
  • You have to tell cd exactly where to look cd
    /u/your_usernameThis tells cd that u is
    contained at the root.
  • Generally any path that begins with a / is an
    absolute path

24
More Than One Way Home
  • Getting Home--here is a list of helpful
    equivalences cd cd cd / cd
    your_username cd your_username/

25
The UNIX File System
  • Dot and Dot-Dot.
  • . and .. are very important to you.
  • . denotes your current directory
  • .. denotes the parent directory (one level up in
    the tree)
  • Examples cd . cd .. ./a.out

26
File Permissions
  • Allowing everyone to see your code is probably
    not a bright idea.
  • You may allow access to certain files or
    directories.
  • Though, not covered here, it is possible to allow
    specific people access to your files.
  • chmod

27
File Permissions
  • The basic modes
  • Read
  • Write
  • Execute
  • The modes apply to
  • User (you)
  • Group (i.e. them)
  • Global

28
File Permissions
  • Viewing permissions ls -l file.txt
  • The format-rw-r--r-- 1 wad them 0 2006-01-27
    1705 file.txt
  • The first segment rw- (read, and write) are in
    the user segment. i.e. me.
  • The second segment r-- (read only) is in the
    group segment. i.e. group them have read
    permission.
  • The last segment r-- (read only again) is in
    the global segment. i.e. anyone can read this
    file.

29
File Permissions
  • Changing permissions chmod gw file.txt ls
    -l file.txt-rw-rw-r-- 1 wad them 0 2006-01-27
    1705 file.txt
  • Now everyone in the group them can write to
    this file... Not a good idea!
  • To protect the file from everyone but yourself
    chmod og-rw file.txt -rw------- 1 wad them 0
    2006-01-27 1705 file.txt

30
File Permissions
  • You can also set permission on directories. ls
    -al foodrwx--x--x 48 wad them 2048 Jan 27
    1628 foo
  • Note the d as in directory.
  • The quick and dirty about directories
  • If the directory is executable, one can cd into
    it.
  • If the directory is readable, one can use ls to
    view the files contained within.

31
Some Other FAQish things
  • To check your disk quota (135 MB) quota -v
  • Copy files from ODIN scp file.on.odin.txt
    username_at_cs.pdx.edu/
  • Print from ODIN cat file.to.be.printed.txt
    username_at_cs.pdx.edu -C 'lpr -Pfab13501bw1'

32
Play With It
  • The only way to become a UNIX guru is to play
    around.
  • Try Linux (Ubuntu, Debian, Slackware, etc.)
  • Read the man pages.
  • Tutorials
  • http//www.cat.pdx.edu/tutors
  • http//acm.pdx.edu
  • If all else fails -gt Google
Write a Comment
User Comments (0)
About PowerShow.com