rcc lunch and learn “ let ’ s start at the very beginning…. ” *

36
RCC Lunch and Learn “Let’s Start at the Very Beginning….”* Februrary 13, 2014 Connie Woodward, [email protected] Dirac Science Library 150 Trivia question & prize to follow at the end about this quote….

Upload: nyx

Post on 11-Jan-2016

34 views

Category:

Documents


0 download

DESCRIPTION

RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *. Februrary 13, 2014 Connie Woodward, [email protected] Dirac Science Library 150. Trivia question & prize to follow at the end about this quote…. Let ’ s Get the Terminology. Operating System - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

RCC Lunch and Learn“Let’s Start at the Very

Beginning….”*Februrary 13, 2014

Connie Woodward, [email protected] Dirac Science Library 150

Trivia question & prize to follow at the end about this quote….

Page 2: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

Operating System Operating systems perform basic tasks, such as

recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, managing the cpu, networking, memory and peripherals

More user related tasks, such as user IDs, user and group permissions, quotas

Let’s Get the Terminology

Page 3: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

The RCC systems all run an operating system called “Linux” Within “Linux” there are different “flavors” (or

“distros) – we run what is called “RedHat Enterprise Edition Linux or RHEL

This is important if you compiling your own programs or something you downloaded from the web, there are slight nuances between the “distros” and you may not be able to follow the documentation exactly if the program was meant to run on a different distro

Terminology – Operating System Continued

Page 4: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

As a user (process or real), you interact with the operating system via a special type of program called a “shell”

Sometimes using the shell is also referred to as using the command line interface (CLI) for linux

There are several different shell programs you can choose from (sh, ksh, bash, csh)

Terminology – Shell

Page 5: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

You select which shell you would like to be your default from the RCC account management web page

Some shells are better for programming in, others are better for interactive use.

If you are not already in love with a particular shell program, I’d recommend using “bash” which is a good, versatile one

Terminology – Shell Continued

Page 6: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

On Macs and Linux boxes, you should find an application called “terminal”, that allows you to do an “ssh” (secure shell) to login to a RCC machine

Windows boxes do not come with an appropriate program, so you must install one that does “ssh”. Commonly one called “Putty” is used, but there are many available.

How You Access

Page 7: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

When you first login to one of the job submission nodes, or a spear node, you are “in the shell” or also referred to as the “command line interface (CLI)”

The Shell

Page 8: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

The Shell

When you first login, you see the “Message of the Day (MOTD)”, which may give important info about scheduled downtimes, outages, etc.

Page 9: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

The Shell After the MOTD, you have a shell prompt displayed.

This can be customized in many ways. Here I have mine showing my userID I am currently

logged as, the hostname of the machine I am on, the directory I am in, and the date:

See attachment A for how I customized my prompt.

Page 10: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

The ShellBy default, your account’s prompt will look like this:

[joe-user@machine ~]$Your user ID @ the machine you are on, then the “~” means your home directory.Your “home directory” is where you are “deposited” when you first login, your “working directory” is whatever directory you are sitting in.Note, directories are to Linux as folders are on Mac or PCs

Page 11: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

Your IdentityYou have a user ID, as well as a default group you belong to, but you may belong to multiple groupsMy defaults:

After I change to the “idadmins” group:

Now any file I create will have the group ownership as “idadmins” and anyone in the “idadmins” group can read/write/execute as I have the group permissions set on the file

Page 12: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

File PermissionsFiles have owner, group and world permission attributes.The basic permission options are: read/write/executeAn “ls –l filename” will show you the permissions set on a file:

In this example, the file can be read & write & executed by the owner (clwoodward), read & executed by anyone in the clwoodward group, and read & executed by the world.

For details on setting file and directory permissions, do a “man” on “chmod”

Page 13: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

DirectoriesTo move to a different directory, you use the command “cd” (change directory):

To check what directory you are currently in, you can use the “pwd” (print working directory) command:

Page 14: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

DirectoriesTo move to a different directory, you use the command “cd directory_you_want_to_go_to” (change directory):

To check what directory you are currently in, you can use the “pwd” (print working directory) command:

Page 15: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

DirectoriesTo move back to your home directory, you can issue just a plan “cd” or you can do “cd ~”(The tilde is an special key for your home directory)

Page 16: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

Getting HelpThere are several ways to invoke the command help system – or what is referred to as the “man” (short for manual) pagesIf you know the command you want info on, and just want to read the details or options available on it, you can do, for example: man df

You can use the spacebar key to go through the pages of information

Page 17: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

Shell – Getting HelpIf you didn’t know the exact command you were looking for, you can do “man –k usage” (or some other appropriate keyword for what you are looking for info on)

You could also do “whatis df” and it would show you a synopsis:

Then you could do “man 1p df”

Page 18: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

DirectoriesOn Linux, the directory structure is specified with forward slashes, like this:

/home/clwoodward

A single “/” is the root of the directory tree“/home” is one level down“/home/clwoodward” is where clwoodward is a subdirectory under “/home”To go back up a directory level, you can do: “cd ..”Or “cd ../../” to go back up two levelsIf you get lost, you can always do a “pwd” to see where you are

Page 19: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

Directories To create a new directory, you use the “mkdir newdirname”

command To remove an empty directory, you can use the “rmdir

dirname” command To remove a directory and all the files in it, you can use the

“rm –rf dirname” command (use with caution)

NOTE – on Linux, when using the shell, if you remove a file or directory, it is gone forever – there is not a “trashcan”/”recycle-bin”

Page 20: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

Working with Files To copy a file, you do “cp oldfile newfile” To rename a file, you can do “mv oldfilename newfilename” To delete a file, you can do “rm filename”

NOTE – on Linux, when using the shell, if you remove a file or directory, it is gone forever – there is not a “trashcan”/”recycle-bin”

Page 21: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

More Working with FilesThere are several ways you can get more information about a file.

“ls –lasg filename” will show you the owner, file system, permissions and last date modified

“file filename” will show you want kind of file it is (text, compiled executable, binary file, image file, etc.)

“cat filename” (if the file is a text file) will display the contents of the file. If the file is big, you may want to do “cat filename | more” which will show your file’s contents a page at a time. You use the spacebar key to move to the next page. (the “|” is a special feature called a pipe, the output from one command is feed to the next command before being displayed)

Page 22: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

Fast TypingThe bash shell allows several cool ways of cheating on your typingOne is “tab completion”, if you start to type a directory name or file name, you can type a few characters, and then hit “tab”, it will then cycle through all the possibilities in the directory that match what you are typing:

Here I typed “cd x<tab>” and it filled in the rest of the matching directory name “xdd”

Page 23: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

Fast Typing - MoreAnother way to save typing is using the up arrow to recall a command, and then arrowiing over and correcting or changing the command as you need

Another trick is to set up frequently used commands as “aliases”.

You set these in your ~/.bash_profile or ~/.bashrc file

~/.bash_profile The personal initialization file, executed for login shells~/.bashrc The individual per-interactive-shell startup files

Page 24: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

Fast Typing - MoreHere are some aliases I have in my .bash_profile:

alias ls=“ls -F --color=auto”

alias ll=“ls –lh”

alias la=“ls –a”

alias df=“df –h”

alias bye=“exit”

alias grep=“grep --color -d skip”

alias gerp=“grep --color -d skip”

alias grpe=“grep --color -d skip”

Notice that I have several misspellings that I commonly type for “grep” and I am telling the system to correct them for me

Page 25: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

More tricksIf you use the default setup for an account, you may notice that when you do an “ls” in a directory, it is hard to tell what is a file, what is an executable file, what is a link, what is a directory, etc.

If you have the right terminal type, then these are color coded:

Page 26: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

More tricksYou can tweak this a bit by changing your “ls” alias to be: “ls –F –color=auto”, then it will but a “*” by executables, a “/” at the end of directory names, and a “@” by names that are links, as well as color code them:

Page 27: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

More tricksThe shell uses the “*” character as a wildcard, so if for example, you wanted to see all the files that start with “slurm”:

Note: be very careful with wildcarding (or sometimes called “globbing”), especially if you are doing a “rm”

Page 28: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

More tricksThe shell uses the “*” character as a wildcard, so if for example, you wanted to see all the files that start with “slurm”:

Note: be very careful with wildcarding (or sometimes called “globbing”), especially if you are doing a “rm”

Page 29: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

Commonly Used Commands

For more info, do a “man” on these commands“cd” – changes to another directory“exit” – logs you out of a shell“kill” – terminates a process“ls” – lists the contents of a directory“date” – prints the date and time“ps/top” – shows the status of processes“chmod/chown” – change the permissions or owner of a file“newgrp” – change your current group to be a different one“chgrp” – change the group owner of a file or directory“mv” – move a file to a new name or location“vi” – a commonly used, very powerful text editor“diff” – compare two files“grep” – a tool for searching for patterns within files“find/locate” – tools for finding files

Page 30: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

Support: [email protected] info: http://rcc.fsu.edu

Google is your friend, there are many, many resources available online. Just search for “bash”, “shell

programming”, “linux shell”, etc.

Questions and Comments

30

Page 31: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

“Let’s start at the very beginning”Is a quote from what 1965 movie?

Trivia!

31

Page 32: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

“Let’s start at the very beginning”Is a quote from what 1965 musical movie?

Hints:ABC shows it every year on TV during the Christmas holidays

Trivia!

32

Page 33: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

“Let’s start at the very beginning”Is a quote from what 1965 musical movie?

Hints:ABC shows it every year on TV during the Christmas holidaysAlmost every high school theatre troup and community theatre performs it

Trivia!

33

Page 34: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

“Let’s start at the very beginning”Is a quote from what 1965 musical movie?

Hints:ABC shows it every year on TV during the Christmas holidaysAlmost every high school theatre troup and community theatre performs itStarred Julie Andrews

Trivia!

34

Page 35: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

“Let’s start at the very beginning”Is a quote from what 1965 musical movie?

Hints:ABC shows it every year on TV during the Christmas holidaysAlmost every high school theatre troup and community theatre performs itStarred Julie AndrewsRecently remade with Carrie Underwood as the lead

Trivia!

35

Page 36: RCC Lunch and Learn “ Let ’ s Start at the Very Beginning…. ” *

“Let’s start at the very beginning”

The Sound of Music

Let's start at the very beginningA very good place to singWhen you read you begin with A B CWhen you sing you begin with Do Re Mi

Trivia!

36