Basic Utility Scripts
|
Remember 1. Create and save the script. 2. Change file permissions (chmod 755) 3. Test the script (./script) 4. Copy the script into your path (cp file /bin) |
Show System Information sysinf
#!/bin/bash
dmesg |more
ip: get current ip address getip
inet0 is my Net device; adjust to suit. Obviously, I'm generally only interested in this ip, because it's the only one that changes.
This simple script is useful in getting that IP address for other scripts that need to know it e.g. those that update my dynamic DNS.
#!/bin/bash
ifconfig eth0
sed -n 's/.*inet addr:\([0-9.]*\).*/\1/p'
#!/bin/bash
#ping internal loopback address
ping 127.0.0.1
Name Service Lookup namelook
#!/bin/bash
echo "Looking up Mt. San Jacinto College..."
nslookup msjc.edu