finals Flashcards
what does a package manager do?
makes it easy for users to manage software on their system. Allows you to do stuff like install, remove, update software
What is an advantage of package manager?
generally handle dependencies. If a package needs additional software to run, the package manager will install it too
What is one of the few tools that makes one Linux distro different from another?
the package manager. And diff distros will have different packages in their package repositories
What’s the package manager for Arch Linux?
pacman
What’s the package manager for Ubuntu?
apt
What’s the package manager for Nix?
nix
What is one of the reasons Arch Linux is so popular?
it has a lot of packages and those packages are generally up-to-date
Which distro has the largest package repository? By how much?
Nix. By ~30% more
pacman command to refresh local package repository?
pacman -Sy
pacman command to upgrade isntalled packages
pacman -Syu
pacman command to install one or more packages and any dependencies
pacman -S <packages>
pacman command to search for a packages
pacman -Ss <search term>
pacman command to remove a package, configuration files, and package dependencies
packman -Rns <packages>
pacman command to display remote information about a package. To display extensive info about a given package??
pacman -Si <package>
what is getopts? What arguments does it take?
it’s a shell builtin that can be used to handle options in shells scripts.
it takes 3 arguments:
- valid options that will be handled
- a variable populated with option arguments (ie “${opt}” )
- a list of options and arguments to be processed $@
what is optarg?
when a flag is set to expect an argument, the argument for that flag is held in the OPTARG variable (eg. my_script -n “ted” <– the OPTARG for -n is the string “ted”)
how to tell getopts to run in silent error checking mode?
Put a colon in the options string
eg. “:a:b:”
the first : tells it to run in silent error checking mode
what does “shift” do?
Shift positional parameters n characters to the LEFT (default is 1 character).
Cannot undo it (no “unshift”).
Shifts are cumulative
how to shift positional parameters to remove any options handled by getopts
shift $(($OPTIND -1))
do the flags and flag options come first or the positional arguments?
flags and flag options should be provided before positional arguments
how to check if there are positional parameters
shift $(($OPTIND -1))
if [[ $# -lt 1 ]]; then
echo “….”
exit 1
fi
What’s FTP?
File Transfer Protocol
Popular method of transferring files to and from remote servers
Why was FTP deprecated?
Lack of security features
What’s SFTP?
Secure(or SSH) File Transfer Protocol
provides functionality similar to FTP, but uses SSH for security