CTRL-L clears terminal `~$ sudo xxx` (act as root user for 1 command) ## SSH `~$ ssh [email protected] (IP)` - no characters will appear when typing password ## echo `~$ echo "hello friend"` - outputs text to terminal. no () required if no spaces - useful for debugging ## whoami `~$ whoami` - find out who is logged in ## SWITCHING BETWEEN USERS `~$ su -l (substitute user)` - switch to a new user. `-l` lets you use their environment - writing `~$ su -` automatically assumes root login ## LOGS `~$ cd /var/log` - rotating (os automatically manages logs) - logs and error logs --- id: Admin created_date: 23/03/2023 updated_date: 23/03/2023 type: note --- `sudo !!` - this will run the last command as sudo root # users `useradd` - `-c` comment (often used for full name) - `-e` set expiration - `-D` display default settings - `-s` change the user's shell - everytime a new user is added, a /home directory is automatically created - root has to first change the password for the new user to login. `usermod` `userdel` - home directories are no automatically removed. - after made sure no data will be loast `rmdir` `chage` - `-l` list or display defualt settings - `-M` maximum days between password changes - `-m` minimum days between password changes - `-W` Warning time for password expiration - `-E` lock an account You will need to run `passwd {user}` to set the password afterwards can check `/etc/passwd` & `/etc/passwd` to confirm creation # Group Accounts /etc/groups -- groups allow you to manage permissions for a large group of people instead of changing each person's individually `groupadd` - create a group `groupmod` - modify an existing group `groupdel` - delete an existing group `gpasswd -d user group` - remove user from a group `usermod -aG sales USERNAME` - adds given user to the group given `/etc/groups` links: [[_LinuxTerminalCMDIndex]] tags: #linux #terminal #CMD