Skip to content

Instantly share code, notes, and snippets.

@curtismckee
Last active September 14, 2019 00:27
Show Gist options
  • Save curtismckee/67392f47a73f773bfb59143b2d70b810 to your computer and use it in GitHub Desktop.
Save curtismckee/67392f47a73f773bfb59143b2d70b810 to your computer and use it in GitHub Desktop.
Useful commands while working with Unix

Add User:
useradd -m -g [group] -G [additional_group] [username]

The -m flag creates /home directory for user

Expire User:
usermod --expiredate [YYYY-MM-DD] [username]

If user try to login, he or she will get the following message:

Your account has expired; please contact your system administrator Authentication failure

Adding .desktop files:
sudo vim /usr/share/applications/program-name.desktop

Adding .deb source:
sudo vim /etc/apt/sources.list.d/name-of-program.list

Import PGP key:
gpg2 --import /path/to/key/name.pgp

Revieve PGP Key:
gpg2 --recv [key]

Export PGP Key:
gpg2 --export [key] | apt-key add -

List system package version:
dpkg -l | grep [packagename]

Create Symlink:
ln -sfv /path/to/file /path/to/symlink

Read Symlink Destination:
readlink /path/to/symlink

Remove Symlink:
unlink /path/to/symlink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment