Getting (to) Linux
foo, bar, baz, username, etc.
How many have it already installed?
Install VM or dual-boot
When stuck on Windows, use PuTTy:
Students:
ssh <username>@linux.cs.wwu.edu
Virtual machines act as a full system on a physical machine
Easy way to test without breaking your machine!
Warning
Your home directories in all CS labs are mounted over NFS. If you run a virtual machine from your home directory you will crash the file server and get your account disabled.
You can stop this from happening by adding "export VAGRANT_HOME=/tmp/$USER-vagrant.d/" to your .bashrc (or .zshrc, etc.) and changing the virtualbox default machine location to /tmp. This setting can be found in File -> Preferences -> General in Virtualbox.
Note
Try other distributions if you like to see what's different. Fedora or Manjaro are great next steps to try out.
Download and install: https://www.virtualbox.org/wiki/Downloads
Grab the latest minimal ISO: http://cdimage.debian.org/debian-cd/current/amd64/iso-cd/
\o/
Note
You can see the gui by uncommenting the line in the Vagrantfile.
# clone
git clone https://github.com/WWUDevOps/vagrantfile
# rename
mv vagrantfile devopsbootcamp-vagrant
# start up
cd devopsbootcamp-vagrant
vagrant up
# access vm
vagrant ssh
Note
We'll get into more detail later in how you can access ports on your VMs and other use cases.
# start
vagrant up
# stop
vagrant halt
# destroy (remove vm)
vagrant destroy
# ssh to the vm
vagrant ssh
Also check out the Vagrant Documentation for more information.
Terminal emulator
Note
Explain architecture: | |
---|---|
built in commands vs. external binaries | |
Demo commands: | Directory movement and file manipulation: Cd, pwd, ls, rm, mv, touch |
User info: | id, whoami, w |
Pipes: | redirection (pipe.txt, redirect.txt) |
Special variables: | |
$?, $$ (pid.sh), !!, !*, !$ |
test@x230 ~ $ tree
.
├── Documents
│ ├── Code
│ │ └── scripts
│ │ └── test.sh
│ ├── School
│ └── Work
└── Pictures
├── manatee.gif
└── turtle.png
6 directories, 5 files
Note
Permissions discussed later.
$ ls -l
$ chmod +x $filename
Arguments are extra information that you pass to a script or program when you call it. They tell it in more detail what you want to do.
$ ls -a -l
$ ls -al
Why pass arguments on the command line rather than having an interactive mode?
test@x230 ~ $ ls
Documents Pictures
test@x230 ~ $ cd Documents/
test@x230 ~/Documents $ ls
Code School Work
test@x230 ~/Documents $
Note
root directory is not to be confused with a home directory for the root account
Tab completion
Automation > Typing > Mouse
ctrl+c kills/quits
read what's on your screen; it'll help you
test@x230 ~ $ tree
.
├── Documents
│ ├── Code
│ │ └── scripts
│ │ └── test.sh
│ ├── School
│ └── Work
└── Pictures
├── manatee.gif
└── turtle.png
6 directories, 5 files
the manual (rtfm):
$ man <program>
$ man man
use /phrase to search for phrase in the document; n for next match
else:
$ <program> --help
Man pages, blogs you find by Googling, StackOverflow
For your future self as well
Start now
It's okay to ask.
Contributions = expertise + time
Don't waste experts' time, but do build your expertise.
Note
Switche to a terminal and show example
Use irssi in screen
# This step is optional, but persistent IRC is cool
$ ssh <username>@<preferred shell host>
# start Screen
$ screen -S irc
# start your client
$ irssi
# after ending ssh session, to get back:
$ ssh <username>@<preferred shell host>
$ screen -dr IRC
/connect irc.freenode.net
/nick <myawesomenickname>
/msg nickserv register <password> <email>
/nick <myawesomenickname>
/msg nickserv identify <password>
/join #osu-lug
/join #devopsbootcamp
/list: |
|
---|---|
/topic: | tells you the current channel's topic |
/names: | tells you who's here |
/say $thing
/join, /part, /whois <nick>, /msg, /help <command>
Note that nothing shows up in the channel when you run a /whois command; it shows up either in your status buffer or your conversation with the person.
12:04 -!- _test_ [~test@c-50-137-46-63.hsd1.or.comcast.net]
12:04 -!- ircname : Example User
12:04 -!- channels : #ExampleChannel
12:04 -!- server : moorcock.freenode.net [TX, USA]
12:04 -!- hostname : c-50-137-46-63.hsd1.or.comcast.net 50.137.46.63
12:04 -!- idle : 0 days 0 hours 2 mins 38 secs [signon: Wed Nov 6
12:00:30
2013]
12:04 -!- End of WHOIS
Tab-complete works on nicknames. use it.
Highlight when people say your name
Symbols are not part of names; they mark status in channel
Logging (expect it); `/set autolog on`
to get back, screen -dr IRC
Can you use man screen to find out what the d and r flags mean?
SCREEN(1) SCREEN(1)
NAME
screen - screen manager with VT100/ANSI terminal emulation
SYNOPSIS
screen [ -options ] [ cmd [ args ] ]
screen -r [[pid.]tty[.host]]
screen -r sessionowner/[[pid.]tty[.host]]
Manual page screen(1) line 1 (press h for help or q to quit)
Lurk more
Show that you're worth helping
Pastebin code
Choose your nick carefully
tail
hat
nick
netsplit
kick/ban/k-line
What's Linux?
I have the script test.py. How do I run it??
How do you list all the files in the current directory?
Give 2 ways to change directory to your home directory.
How do you reconnect to a screen session?
Give an example of something which you should not do in IRC