2025-06-12 18:00:33 +03:00
|
|
|
#+title: Lesson 05 | Command line Environment
|
|
|
|
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/missing-semester.css" />
|
|
|
|
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/org-media-sass/collapsible.css" />
|
|
|
|
|
#+HTML_HEAD: <script src="../_share/media/js/collapsible.js"></script>
|
|
|
|
|
#+OPTIONS: H:6
|
|
|
|
|
|
|
|
|
|
* Links
|
|
|
|
|
#+attr_html: :class links
|
|
|
|
|
- [[../toc.org][TOC | Missing Semester]]
|
|
|
|
|
- [[https://www.youtube.com/playlist?list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J][Playlist: Missing Semester]]
|
|
|
|
|
- [[https://www.youtube.com/redirect?event=video_description&redir_token=QUFFLUhqbVVJc2RzZ25nMmlrVW5zVGRsTS1fX2ladmRPQXxBQ3Jtc0ttWjQ5Ujcyd19TekNncTZGNEp1eDc3RWhzTzhvMW9oSTFoUl9JbGt1Mi0yU3FLc00wVUx1UXNJdFQxTjBjMWphdUZxNnU1WUYzTmFqd3RRemNLUDBJMlZkV3B0SnB4RVhpaUhvWWtnc1RISW1WVzdYWQ&q=https%3A%2F%2Fmissing.csail.mit.edu%2F2020%2Fcommand-line%2F&v=e8BO_dYxk5c][class notes]]
|
|
|
|
|
|
2025-06-17 06:06:01 +03:00
|
|
|
- Curr: https://youtu.be/e8BO_dYxk5c?si=6klAbSninuA4qcGy&t=67
|
2025-06-12 18:00:33 +03:00
|
|
|
|
|
|
|
|
*** timestamps
|
|
|
|
|
:PROPERTIES:
|
|
|
|
|
:CUSTOM_ID: timestamp
|
|
|
|
|
:END:
|
|
|
|
|
|
|
|
|
|
#+attr_html: :class playlist
|
|
|
|
|
+ [[https://youtu.be/e8BO_dYxk5c?si=A-imhHunQCtp_-Oz][00:00 - introduction]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=138s][02:18 - Job Control]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=227s][03:47 - Signal Interrupts]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=360s][06:00 - Python Program]]
|
2025-06-17 06:06:01 +03:00
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=672s][11:12 - The Kill Command]] *current*
|
2025-06-12 18:00:33 +03:00
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=881s][14:41 - Terminal Multiplexer]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=1112s][18:32 - The Key Bindings]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=1536s][25:00 - Dot Files]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=1799s][29:59 - Context Based Configuration File]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=2004s][33:24 - Terminal Emulator]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=2196s][36:36 - Aliases]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=2286s][38:06 - Common Folder Structure]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=2344s][39:04 - Symlinks]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=2552s][42:32 - ssh]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=2715s][45:15 - ssh keys]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=3057s][50:57 - ssh config]]
|
|
|
|
|
+ [[https://www.youtube.com/watch?v=e8BO_dYxk5c&t=3231s][53:51 - changing the prefix]]
|
|
|
|
|
|
|
|
|
|
* notes
|
2025-06-12 18:08:40 +03:00
|
|
|
|
|
|
|
|
** 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
|
2025-06-12 18:39:56 +03:00
|
|
|
|
|
|
|
|
** 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
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC python
|
|
|
|
|
import signal
|
|
|
|
|
def handler(signum, frame):
|
|
|
|
|
printf("signal received")
|
|
|
|
|
|
|
|
|
|
signal.signal(signal.SIGINT, handler)
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
|
|
- 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
|
2025-06-17 06:06:01 +03:00
|
|
|
|
|
|
|
|
** 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
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC bash
|
|
|
|
|
nohup sleep 2000 & python somprog.py
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
|
|
*** 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
|
|
|
|
|
#+BEGIN_SRC bash
|
|
|
|
|
bg %1
|
|
|
|
|
#+END_src
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
** kill command
|