Linux Admin
Basic Commands
Add/Remove Programs
dpkg -l | grep -i someapp
- find package nameapt-get update
(fetch updates)apt-get upgrade
(apply updates)- see askUbuntu, What is the correct way to completely remove an application?
apt-get remove packagename
→ removes the binaries, but not the configuration or data files of the package. It will also leave dependencies installed with it on installation time untouched.apt-get purge packagename
orapt-get remove --purge packagename
→ will remove about everything regarding the package, but not the dependencies installed with it on installation. Both commands are equivalent.
Useful when you want to 'start all over' with an application because you messed up the configuration. However, it does not remove configuration or data files residing in users home directories, usually in hidden folders there. There is no easy way to get those removed as well.apt-get autoremove
→ removes orphaned packages, i.e. installed packages that used to be installed as an dependency, but aren't any longer.
- ask Ubuntu, How to uninstall a package installed from snapcraft?
Upgrade Programs
Sometimes need to know how a program was installed — Example for zoom:
- First, try
which zoom
orwhich zoom-client
to get the path to the executable. Inspect the path root:- /snap was installed by Snap (Or the Ubuntu Software Center), then
snap list | grep -i zoom
to get full/correct Snap name - /usr/bin it was probably installed with
apt
or Synaptic —dpkg -l | grep -i zoom
orapt policy zoom*
will tell you more.
- /snap was installed by Snap (Or the Ubuntu Software Center), then
- Run the Synaptic Package Manager (
sudo apt install synaptic
) and look at the "Installed (Local or Obsolete)" filter - Flatpak — check with
flatpak list | grep -i zoom
- Ubuntu Make — check with
umake --list-installed
(For example, IDEs)
Create Users
useradd
is native binary compiled with the system- requires -m to create '/home/username' directory
adduser
is a perl script which uses useradd:- more user friendly and interactive than useradd
- automatically creates '/home/username' directory
man page for adduser
adduser
and addgroup
add users and groups to the system
according to options and configuration in /etc/adduser.conf.
They are friendlier front ends to the low level tools like useradd, groupadd and usermod programs, by default choosing policy conformant UID and GID values, creating a home directory with skeletal configuration, running a custom script, and other features.
adduser
and addgroup
can be run in one of five modes...
man page for useradd
:
useradd
is a low level utility for adding users.
Administrators should usually use adduser
.
GPU/NVDIA Commands
This section has been expanded and moved to NVIDIA Setup & Maintenance
Make the uploads folder writable
> cd /home/shanebow/public_html
> sudo chmod -R 775 uploads
> sudo chown shanebow uploads
Install node.js and PM2
> curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
> curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
> sudo apt-get install -y nodejs
> node -v
v10.14.0
> sudo npm i -g npx
> sudo apt-get install -g pm2
Don't forget to make the server executable withsudo chmod 775 server.js