Debian
apt commands
Most used commands
list - list packages based on package names
search - search in package descriptions
show - show package details
install - install packages
reinstall - reinstall packages
remove - remove packages
autoremove - Remove automatically all unused packages
update - update list of available packages
upgrade - upgrade the system by installing/upgrading packages
full-upgrade - upgrade the system by removing/installing/upgrading packages
edit-sources - edit the source information file
To search for a package
apt-cache search gcc
See a description of package
apt-cache show gcc
Install a package
sudo apt install gcc
Remove a package
sudo apt remove openmpi-bin
To upgrade all packages to latest version
sudo apt update
sudo apt list --upgradable # check if you really want to upgrade all packages
sudo apt upgrade
Setting the locale
If the locale is not set correctly, you can get weird errors while installing some softwares. Edit the file /etc/locale.gen
with this line
en_US.UTF-8 UTF-8
and run sudo locale-gen
command in the terminal.
Changing hostname
Edit /etc/hostname
and /etc/hosts
files. If using systemd, run
hostnamectl set-hostname HOSTNAME
Install packages
I use Spack to install scientific packages. Before that, install some needed dependencies
sudo apt install gcc g++ gfortran gnuplot make curl wget git vim
Essential compilers can also be installed like this
sudo apt install build-essential
To get GL/gl.h
, install
sudo apt install mesa-common-dev
Next see the Spack tips for installing other softwares. openmpi will also be installed by Spack, so do not install it from apt.
Install locate
sudo apt install locate
sudo updatedb
To get ifconfig
sudo apt install net-tools
export PATH=$PATH:/sbin
For PDF viewing
sudo apt install xpdf evince
Enable ssh connections
systemctl start ssh
systemctl enable ssh # to automatically start at next boot
Check that sshd is started using
systemctl status sshd | grep Active