contents -
:1.Know your machine 💻
:2.Monitoring 🔧
:3.Tweaks for better Administration 👨🏻💻
:4.Networking 📡
:5.Searching 🔍
:6.Automation ⚙️
:6.RHEL Web Console 👾
exploring
--------------------------------------------
1. Know your machine 🖥🖥️
1.Display Linux system information-
uname -a
2.Show operating version & name-
cat /etc/os-release
3.Show host name-
hostname
hostname -I
4.Display CPU information-
cat /proc/cpuinfo
5.Display memory/RAM -
cat /proc/meminfo
6.Display RAM usage (redable, in MBs, in GBs)
free -h
free -m
free -g
7.Displays all environment variables running on the system.
env
8.Display DMI/SMBIOS (hardware info) from the BIOS
dmidecode
2.monitoring
1.WATCH - shows periodic updates
watch df -h
2.Monitor all traffic on port
tcpdump -i device 'port port_n0'
for example-
tcpdump -i enp0s3 'port 9090'
3.Display the last 100 syslog messages
tail -100 /var/log/messages
4.reboot History
last reboot
5.History - to check previous commands.
history 100
6.NMON - 'TOP' alternative for monitering-
nmon
NMON can be used as a better 'top' alternative.
1.CPU utilization,
2.Memory
3.Disks
4.Network utilization & more
In a better viewe where refresh rate can be adjusted by pressing +, - buttons.
Stats can be saved to CSV for later analysis & graphing.
File Exploring
List only directories
ls -d */
List files with subdirectories
ls *
List files recursively
ls -R
List files with their sizes
ls -s
List files in long format
ls -lrt
List files in long format with readable file sizes
ls -lh
List files including hidden files
ls -a
List files and sort by file size
ls -S
-t <- time
-r <- reverse
3.Tweaks for better Administration
1.Record Terminal session -
to start recording session-
script script_name.txt
to stop session-
exit
to view the recorded session-
cat script_name.txt
2.Increase SSH timeout -
vi /etc/ssh/sshd_config
insert/assign values as per following to set timeout to 1 hour -
ClientAliveInterval 1200
ClientAliveCountMax 3
3. long running command in background -
long running commands can be sent to background by simply using '&' after the command. Ampersand instructs the shell to execute the command as a separate background process.
for e.g checking unreadable blocks on disk took hours to get finished, So this job will be sent to background-
badblocks -s /dev/sda &
to check status - jobs
4. nohup
nohup is extension to '&' , is used to keep the process running in background even after user logs out,
nohup your_command &
e.g. nohup sh script_runner.sh &
to check status - jobs
5. TMUX -
to enable second terminal pane for multitasking without opening a second session.
- Type
tmux
- To open second pane - Ctrl + b then Shift + 5(%)
- To switch pane - Ctrl + b then left arrow or right arrow to switch the curser.
- To close pane - Ctrl + b followed by d
- type
tmux attach
to open the earlier pane. (after closing the pane session continues running in bg)
6. DISOWN -
disown command removes the given process from running terminal shell & runs in background until completion. this can be used for long running jobs on time limited sessions.
networking
4.Networking
1.Monitor all traffic on port
tcpdump -i device 'port port_n0'
e.g. tcpdump -i enp0s3 'port 9090'
Check connectivity & port opening status
ssh -vvv <IP> -p <PORT>
ssh -vvv 192.168.186.42 -p 9090
searching
5.Searching
1. AWK -
awk options 'selection _criteria {action }' input-file > output-file
console
6.RHEL Web Console
A web-based interface can be used for managing and monitoring RHEL systems in realtime. Follow the commands to enable & use RHEL web console-
Enable web console -
systemctl enable --now cockpit.socket
if cockpit package not installed -
dnf install cockpit
open port 9090 for web console -
firewall-cmd --add-service=cockpit --permanent
open browser & type URL -
https://IP or hostname:9090
e.g. https://192.168.186.42:9090/system
Top comments (1)
RHEL 9's web console is the best.