ssh or secure shell is a cryptographic network application used
to connect to a remote command line application. = You need to have an AFS home directory to connect to university Linux servers.
ssh.unique_name with your UM unique name (the part of your
UM email address preceding @umich.edu).hostname to see name of host you were connected to. bash slideshow={"slide_type": "code"}
ssh unique_name@login.itd.umich.edu
/. /.ls (list files), ls -a, ls -lcd (change directories)pwd (print the current or working directory)mkdir (make directory), mkdir -prmdir (remove directory)rm (remove a file), rm -rmv Move a file or directoryfind Find a file.. refers to the current directory,.. refers to the parent directory, one step up the file tree.cd invoked with no arguments will return you to your home directory... ls -a.* matches any sequence of characters? matches any single character..* matches all dot files.ps1.* would match all extensions to files named
ps1 (e.g. ps1.py, ps1.light.py, ps1.ipynb).ps?.py would match ps1.py and ps2.py but not
ps1.light.py. HOME (location of your home directory)SHELL (the shell you are using to interface with the machine)PATH (locations to search for executable programs)$ to access the value of an environment variable. echo command can be used to print these values to the screen, e.g.
echo $SHELL.$ vs the % prompt used
by csh, zsh, and other shells.which to search your $PATH for an executable command. PATH.~ will often be expanded as $HOME.~/github/Stats_507/ vs /Users/jbhender/github/Stats507. emacs README.md will open (or create) a file named README.mdcntrl+x, cntrl+s to savecntrl+x, cntrl+w to write (save as)cntrl+x, cntrl+c to close.cntrl+g to quit command window,cntrl+k "kill" (delete) to end of line,cntrl+a (cntrl+e) move to start (end) of line.cntrl+x to search,esc (meta), shift+5 find and replace,cntrl+x, shift+9 define keyboard macro,cntrl+x, shift+0 to end,cntrl_x, e to execute, then e to execute again.more and less.less:less README.md to open, -S to scroll.q to quit,/ to search, n for next match,space bar to page. tmux, a terminal multiplexer.screen is another option. tmux new -s 507_live creates a new session named 507_live.cntrl+b:cntrl+b, c creates a new window,cntrl+b, n (p) moves to the next (previous) window, cntrl+b, [0-9] will move to a specific window number.cntrl+b, d to detach (or type tmux detach) a session.507_live, tmux a -t 507_live.tmux ls.cntrl+b, shift+' splits the active window horizontally.cntrl+b, shift+5 splits the active window vertically.cntrl+b, arrow (or o) to move between panes. cntrl+b, space bar to cycle through layouts. cntrl+b, z to zoom (or focus) the active pane. cntrl+z (processing stops)bg.&. fg. %1. jobs to see all jobs. scp - most common way to transfer small to medium sized files,wget - download data directly to the remote host from the web,sftp - interactive file transfer. git and a "third-party" server such as
GitHub or BitBucket (more in next lecture). cp for copying to and from local locations, scp or
secure copy is used to transfer to and/or from remote locations.scp host:/path/to/folder/file.txt ./ will copy from file.txt from
the remote host (host) to the current (local) directory.scp ./file.txt host:/path/to/folder will copy the (local)
file file.txt to the specified folder on remote host host. wget to download files from the web directly to a remote host:
wget https://www.eia.gov/consumption/residential/data/2015/csv/recs2015_public_v4.csvsftp.cd, pwd, ls. put to copy a file from the local connection to the remote.get to copy a file from the remote to local. stdin or standard input, stdout or standard output, and,stderr or standard error. /dev/
directory, e.g. /dev/stdin, /dev/stdout and /dev/stderr.stdout and stderr to communicate to the
user as these streams print to the console.> (for stdout)
and & (for stderr). stdin using
<, e.g. < file.txt.stdout using echo.welcome.txt.>>. welcome.txt to stdin for the tr or translate tool.echo hello!
echo hello! > welcome.txt
echo 'stats 507!' >> welcome.txt
< welcome.txt tr '[a-z]' '[A-Z]'
stdout from one command to stdin for the next using
a pipe |. echo 'hello stats 507!' | tr '[a-z]' '[A-Z]' | tr ' ' \n
du or disk utilization utility can be used to see the space
on disk used by one or more files.-h option to print values in human readable units. -s to get sum totals for a directory or files matching a glob.gzip. gzip file.txt compresses file.txt into file.gz.gunzip file.gz or gzip -d file.gz-c option: gunzip -c file.gz > file.txt. zcat command is a shortcut that does the same thing.tar cvfz name.tgz ./parent_folder,tar xvfz name.tgz..tgz is short for .tar.gz indicating that the archive has
been compressed using gzip.head and tail commands are useful in this respect: head - read the first n lines of a filetail - read the last n lines of a file tail can be used with a + to read from line n.wc - count words or use wc -l to count lines.grep - find lines in files that match string patterns using regular
expressions. nl - number the lines in a file.sort - sort a file on one or more fields.cut - extract select columns from a delimited file.paste - concatenate files line by line.join - merge two files based on a common field.tmux, a terminal multiplexer. scp, sftp, or wget to get data to and from remote hosts.