All Things Techie With Huge, Unstructured, Intuitive Leaps
Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts

Linux Bash How to show line numbers in vi

This is more of a reminder to myself than anything else. When I am working directly on the Linux server (Centos is my flavor of choice), I often need to find a line number. I have used vi and other editors for a long long time (since the days when unicorns wandered the earth), but I still forget some things. Like today, I had to look up how to turn on line numbers in vi.

It really is simple.

Hit the "Esc" escape key and type:

:set number

On some flavors of Linux:

:set nu

also works.


Easy peasy, now if I can just remember this.

Sending Mail From Linux Using Bash Shell

This was a quick and dirty bash shell for send email from a command line. The body of the email was the same, and the email was going out to a bunch of people.

Using vi, I created a file in /home/tmp/mailmessages with the body of what I want to write. For this example it is /home/tmp/mailmessages/myFileTellingEveryone

Then I created the following bash script, name mymailer and put in the /bin or /sbin directory:

#!/bin/bash
IFS=":-;"
#FILE= "/home/tmp/mailmessages/$3"
#echo $(basename "$2")
mail -s $(basename "$2") $(basename "$1") < /home/tmp/mailmessages/$(basename "$3")


Do a chmod so that you can execute it (chmod 777 works for me) and now all I do is type:

#mymailer me@me.com "This is my Subject" myFileTellingEveryone

I just keep changing the email address and I can send out this way.