ECE 208/408 Lecture 2, Melissa Chen1/13/2022 4
Linux Shell Scripts
•
Unix shell is a!command-line interpreter [1]. It is a program that takes commands from the keyboard and gives
them to the operating system to perform.
•
“Terminal” is where you can interact with the shell.
•
Unix-like systems: Linux, MacOS. For Windows, see “batch files”.
[1] Kernighan, Brian W.;!Pike, Rob!(1984), "3. Using the Shell",!The UNIX Programming Environment, Prentice Hall, Inc., p.!94,!ISBN!0-13-937699-2
[2] https://github.com/wookayin/gpustat
Source: gpustat
Basic structure: command -[option] parameter1 parameter2 …
Interact with the system:
Cheatsheet: https://github.com/RehanSaeed/Bash-Cheat-Sheet
Package management:
Advanced Package Tool (or APT), the main command-line!package manager!for Debian and its derivatives.
System and hardware monitor:
CPU (example here): htop
GPU:
nvidia-smi
watch -n 2 | nvidia-smi
gpustat [2] (dynamic, recommended)
APT Examples:
$ apt update && sudo apt upgrade
$ apt install xxx
$ apt remove xxx
Bourne shell!(sh), GNU Bash!(bash), PowerShell!(msh), Z shell!(zsh), Secure Shell!(ssh)
Line-by-line in terminal or In a file