Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Looking at scripts

● cat
● ­less
● ­nano
● ­vim

Shebang (AKA Hashbang)

Notice the #! in the first line?

● ­ his is called a "Shebang"


T
● ­It tells your shell which program should interpret the script

Privileges

● Remember that users can only write on their home dir?


● ­What if we need to write files somewhere else?
○ ­Only the root user can do that
● ­You need to either become root...
● ­...or run a command with root privileges
● ­ or security reasons, you should not use the root account for any longer then
F
strictly necessary

Escalating privileges

● In order to become root you have to switch to the root "user"


○ ­Just use su root (or the short form su)
● ­This will not work on Ubuntu by default
● ­The root account is disabled
● sudo is the answer
○ ­Stands for "superuser do"
● ­sudo <command>
○ ­Allows an unprivileged user to run a command with elevated privileges
○ ­Asks for the user authentication
● ­Provided said user is authorized to use sudo
● ­Usually authorized users are part of the sudo group
● ­sudo can be considered a weapon of mass destruction if used carelessly

Updating our system

● An example of a task that requires elevated privileges is performing an update to our


system
● ­You have to write the updated files to system directories
○ ­The commands are:
■ ­sudo apt update
■ sudo ­apt dist-upgrade
What does a package manager do?

● The "correct" way to manage programs on a GNU/Linux system


● ­They will handle all of the process
○ ­Installing programs
○ ­Removing programs
○ ­Updating programs
○ ­Keep track of all this activity

Package manager concepts

● Packages
○ ­Single file containing the software and metadata
○ ­.deb, .rpm, .tar.xz
● ­Dependencies
○ ­Some packages need others to work
○ ­Eg. numpy depends on python
● ­Package database keeps track of:
○ ­All installed packages/files
○ ­All available packages
○ ­All installed packages' metadata
● ­Repositories
○ ­Store remote packages
○ ­Store remote databases

User space package managers

● pip
● cran
● npm
● conda

Conda

● A package, dependency and environment manager for any language


● ­Used to install packages, without requiring root access
● ­Can be used to manage isolated environments

You might also like