5.1 KiB
Executable file
5.1 KiB
Executable file
Lesson 05 | Command line Environment
Links
- TOC | Missing Semester
- Playlist: Missing Semester
- class notes
- Curr: https://youtu.be/e8BO_dYxk5c?si=7tmshQsaihcvs-aP&t=2018
timestamps
- 00:00 - introduction
- 02:18 - Job Control
- 03:47 - Signal Interrupts
- 06:00 - Python Program
- 11:12 - The Kill Command
- 14:41 - Terminal Multiplexer
- 18:32 - The Key Bindings
- 25:00 - Dot Files
- 29:59 - Context Based Configuration File current
- 33:24 - Terminal Emulator
- 36:36 - Aliases
- 38:06 - Common Folder Structure
- 39:04 - Symlinks
- 42:32 - ssh
- 45:15 - ssh keys
- 50:57 - ssh config
- 53:51 - changing the prefix
notes
topics
- job control
- terminal multiplexers
- dot files / how to configure
- work with remote machines
job control
sleep
- puts process to sleep for a specified amount of time
- exit by typing Ctrl-C
Ctrl-C
- sends SIGINT - signal interrupt
- man signal will show the list of signals
signals
- SIGQUIT
- signal sent when we want to quit
- SIGTERM
- similar to quit but not in term
- SIGHUP
- when we have processes running but still want to close
pausing
- SIGSTOP
- pause execution of program
- SIGCONT
- continue program
python library
- use import signal
import signal
def handler(signum, frame):
printf("signal received")
signal.signal(signal.SIGINT, handler)
- the above would catch a Ctrl-C and run it through handler
- you use this by catching a Ctrl-C and running any saves or cleanup before exiting
nohup and jobs
- allows for a process to continue livign when the terminal is killed
example
- sleep put the process to sleep
-
'&' puts the process in the background
- wont take over the process
nohup sleep 2000 & python somprog.py
jobs
jobs
will show the suspended and running processes in background
-
how to restart a suspended process
- type 'jobs' to see what there is in this terminal
- the find the jobs number, ie [1] or [2]
-
use the 'bg' command
bg %1
kill command
- allows you to send any kind of signal to a job
- e.g. "stop" will suspend but not close the job
some commands
- HUP
- Hang Up
- STOP
- suspend
- KILL
- kill it no matter what
Terminal Multiplexer
overview
- tmux
- lets you create workspaces that you can work in
- rearrange the environment
- have different settings
core concepts
-
hierarchy
- sessions
- windows
- panes
dot files
alias
- remap a source series of characters to a longer series
- alias takes a single argument, ie, do not use spaces
-
to show what an alias refers to pass the alias to the alias command
- e.g.
~/somedirectory >>> alias myaliasedcommand
myaliasedcommand='ls -lah'
examples
- make an alias "ll" for a list command with flags
alias ll="ls -lah"
- make an alias for git status
alias gs="git status"
- alias to prompt for an override
alias mv="mv -i"
text based configuration 'dot files'
-
called 'dot files' because they start with a dot
-
.bashrc
- must be in the home directory
-
PS1
- prompt variable for your prompt
- you can set it in the .bashrc file
PS1=" >> "
-
.vimrc
- vim configuration file
-