• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Ulysses

Display certain lines in a file

March 23, 2023

This will display only lines 40-50 in a file called lines.txt.

$ cat lines.txt | head -n 50 | tail -n 10

$ cat lines.txt | head -n 50 | tail -n 10

For lines 90-100.

$ cat lines.txt | head -n 100 | tail -n 10

$ cat lines.txt | head -n 100 | tail -n 10

and so on.

Filed Under: Linux Tagged With: cat, display, head, lines, tail

Memory Info on Linux

March 15, 2023

Here’s how to view system memory on Linux.

Default display is in kB

cat /proc/meminfo
MemTotal:        7492768 kB
MemFree:          427368 kB
MemAvailable:    5424768 kB

cat /proc/meminfo MemTotal: 7492768 kB MemFree: 427368 kB MemAvailable: 5424768 kB

Display in MB

awk '$3=="kB"{$2=$2/1024;$3="MB"} 1' /proc/meminfo | column -t
MemTotal:           7317.16      MB
MemFree:            404.527      MB
MemAvailable:       5285.4       MB

awk '$3=="kB"{$2=$2/1024;$3="MB"} 1' /proc/meminfo | column -t MemTotal: 7317.16 MB MemFree: 404.527 MB MemAvailable: 5285.4 MB

Output in GB

awk '$3=="kB"{$2=$2/1024^2;$3="GB";} 1' /proc/meminfo | column -t
MemTotal:           7.14566      GB
MemFree:            0.370392     GB
MemAvailable:       5.13733      GB

awk '$3=="kB"{$2=$2/1024^2;$3="GB";} 1' /proc/meminfo | column -t MemTotal: 7.14566 GB MemFree: 0.370392 GB MemAvailable: 5.13733 GB

Filed Under: Linux Tagged With: display, linux, meminfo, memory, proc

Yum Version Lock

February 21, 2023

How to lock a package or software in RedHat.

# For RHEL 5
yum install yum-versionlock
# For RHEL 6 and 7
yum install yum-plugin-versionlock
# For RHEL 8 and 9
yum install python3-dnf-plugin-versionlock

# For RHEL 5 yum install yum-versionlock # For RHEL 6 and 7 yum install yum-plugin-versionlock # For RHEL 8 and 9 yum install python3-dnf-plugin-versionlock

Locking a package

yum versionlock gcc-*

yum versionlock gcc-*

List locked packages

yum versionlock list

yum versionlock list

Filed Under: Linux Tagged With: install, lock, package, redhat, versionlock, yum

Key-Based SSH Prompting Password

February 21, 2023

Key-based SSH login is prompting a password despite it’s already setup to use keys. As turns out, the home directory was changed to 777. To fix, I changed home folder permissions and restarted SSH. It probably does not need a restart, but it doesn’t hurt.

chown -R username:username /home/username
find /home/username -type d -exec chmod 755 {} \;
find /home/username -type f -exec chmod 644 {} \;

chown -R username:username /home/username find /home/username -type d -exec chmod 755 {} \; find /home/username -type f -exec chmod 644 {} \;

sudo systemctl restart ssh

sudo systemctl restart ssh

Filed Under: Misc

Missing RHEL Prompt on Bash

February 20, 2023

Here’s how to restore or set the Bash prompt on RHEL systems.

echo "PS1='\u@\h \w]\$'" >> ~/.bashrc
source ~/.bashrc

echo "PS1='\u@\h \w]\$'" >> ~/.bashrc source ~/.bashrc

Filed Under: Linux Tagged With: bash, missing, prompt, restore, rhel, set

GCP Backend Services Health Status

February 14, 2023

Here’s how to get health status of a GCP Load Balancer Backend Services.

For all load balancers except target pool.

gcloud compute backend-services get-health BACKEND_SERVICE_NAME \
--region us-central1 \
--project project-id

gcloud compute backend-services get-health BACKEND_SERVICE_NAME \ --region us-central1 \ --project project-id

For target pool load balancers, use this command.

gcloud compute target-pools get-health TARGET_POOL_NAME \
--region us-central1 \
--project project-id

gcloud compute target-pools get-health TARGET_POOL_NAME \ --region us-central1 \ --project project-id

Filed Under: Cloud Tagged With: backend-service, gcp, health, load balancer, status

AWS RDS Enable Performance Insights

February 13, 2023

Here’s how to enable performance insights on a RDS instance.

Enable

aws rds modify-db-instance \
--db-instance-identifier sample-db-instance \
--enable-performance-insights \
--region us-east-1 \
--profile default

aws rds modify-db-instance \ --db-instance-identifier sample-db-instance \ --enable-performance-insights \ --region us-east-1 \ --profile default

Disable

aws rds modify-db-instance \
--db-instance-identifier sample-db-instance \
--no-enable-performance-insights \
--region us-east-1 \
--profile default

aws rds modify-db-instance \ --db-instance-identifier sample-db-instance \ --no-enable-performance-insights \ --region us-east-1 \ --profile default

Filed Under: Cloud Tagged With: aws, instances, performance insights, rds

GCP BMS List LUNS in Volume

February 11, 2023

Here’s how to list the luns for a particular volume.

gcloud bms volumes luns list --project project-id --region us-central1 --volume at-xxxxxxx-volxxx

gcloud bms volumes luns list --project project-id --region us-central1 --volume at-xxxxxxx-volxxx

Filed Under: Cloud Tagged With: bms, gcp, list, luns, volume

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 125
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2023