Debian
Package installation
dpkg
Install a package from a .deb file
sudo dpkg -i PACKAGE_NAME
Remove a package
sudo dpkg -r PACKAGE_NAME
Purge a package
This removes the package and all its dependencies
sudo dpkg -P PACKAGE_NAME
List installed packages
dpkg -l
File movement
Copy files from directory into another
cp -a /source/. /dest/
Move files into parent directory
mv subfolder/* .
Web hosting
Give permissions to a user to use /var/www for static files
See this post for a good summary of things to watch for. For static files there shouldn't be anything that needs to be written by the webserver.
sudo gpasswd -a "$USER" www-data
sudo chown -R "$USER":www-data /var/www
find /var/www -type f -exec chmod 0640 {} \;
sudo find /var/www -type d -exec chmod 2750 {} \;
Can then confirm permissions with
ls -la
Localhost
Kill a process running on localhost
First, find the process using
lsof -i :3000
Then, kill the process via the PID
kill <PID>
User management
Create a new user with sudo
Create the new user. Need to use sudo
if not signed in as root.
adduser <newuser>
Give sudo priveleges
usermod -aG sudo <newuser>
Useful terminal commands
cmp
- Compares to see if two files are equivalent