Skip to content

Admin Stuff

Create (Sudo) Users

# List users
grep "bash" /etc/passwd | awk -F: '{ print $1}'
# Add new user
adduser <username>
# Delete user
userdel -r <username>
# Set passwort
passwd <username>
# Give user sudo powers
gpasswd -a <username> wheel

Manage User

The chage command is used to modify user password expiry information. It enables you to view user account aging information, change the number of days between password changes and the date of the last password change.

# Info
chage -l <username>
# Set expire date
chage -E 2021-03-17 <username>

Network Statistics

Displays network connections (both incoming and outgoing), routing tables, and a number of network interface statistics.

netstat -i

System Setup

Static IP address:

Hardware address:

ifconfig -a
dmesg | grep eno3 

How to generate UUID for network interface on RHEL:

uuidgen eno3

Welcome Message (text only)

(1) Message of the day

vim /etc/motd

(2) Login Message (text only)

vim /etc/login.txt

(3) PAM

vim /etc/pam.d/login

(4) Scripts

vim /etc/profile.d/login.sh

Alias

Alias in bash can be termed simply as a command or a shortcut that will run another command/program.

User-Level Alias

Place to store your alias: ~/.bash_aliases

Add the follwoing line to ~/.bashrc

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi
# List idefined alias
alias
# Syntax
alias src="source ~/.bash_aliases"
# Deactivate an alias
unalias <name>

System-Wide Aliases

Place for global aliases: /etc/bash_global_aliases

Add the follwoing line to ~/.bashrc

# Source global definitions
if [ -f /etc/bash_global_aliases ]; then
    . /etc/bash_global_aliases
fi