In the US, Halloween is celebrated by young children dressing up as ghouls, ghosts, and demons of other sorts. I think the original idea of costumes was to be the scarier demon, which means if I look like a bad ass demon then maybe the truly bad ass demons will run away in fright. This made me wonder What do I truly find scary? Turns out it is not graveyards, ghosts, or even vampires – no it’s operating system command lines.
DOS is Spooky, Linux is Just Scary
You can’t really use a computer without suffering through the operating system. For most of my early career this meant working with command line interfaces. You have to be incredibly accurate to work on a command line and know the exact name of everything. One mistyped date or filename and months of work could disappear before your eyes – now that is really scary because you could also delete other people’s hard labor as well.
I remember my first time using an Apple Macintosh. My professor’s first comment was “Look you can just drag and drop files. If you make a mistake just pull it out of the Trashcan.” Yes – it was wonderful. It was amazing to me that any command line operating system would survive. Why didn’t the masses of folks rise up in protest? “We want our Recycle Bins!” and “Steve Jobs wants your head demons!”
My Exorcism Failed, Now What?
One way to rid yourself of demons is to call a priest who can perform an exorcism. Apparently command line operating systems are immune to even the most potent of holy men and persist in organizations. It seems like every other project I’m on requires Linux savviness. My original problem is that I really only know the very basics. I admit I only learned enough to get the job done. However many more customers are installing SAS Visual Analytics on Linux, so it is pushing me to learn more as well. Since these demons aren’t going anywhere – how do I collect my own bad ass demons to help make the task less scary and op sys more usable.
Help me be More Scary!
Many users find working with the command line gives them more flexibility and power. One thing I like about Windows is the ability to put a shortcut on the desktop – this way I don’t have to remember where the subdirectory that has the logs is located and one quick click takes me there. In Linux, there is a similar concept called alias. Basically an alias allows you to store a shortcut. For instance, if I want to start the SAS Management Console then I would something similar to this:
I’m using MobaXterm Professional to manage my Linux connections and interface. It’s another change that has made working with Linux more tolerable. However, I can setup an alias allowing me to type “sasmc” which does the same thing. This is because I set it up as alias. This is something I would keep in my Evernote SAS notebook so I could use it between projects.
Tell me more …
This turned into a really handy trick for me as I added some other aliases for sub-directories that I use a lot but again can’t always remember the names. For instance, the log files for the various SAS VA Components. What I really appreciated is that setting up the alias was not that difficult. Here’s the steps I used to create an alias. If you have difficulty using these steps then speak to your system administrator. [Here’s a reference page for more information: The alias Command and Unix Bash Alias Tutorial.]
- Edit thebashrc file using your favorite editor. I use NANO instead of VI.
> nano ~/.bashrc - Add the shortcut to the file. The syntax is alias shortcut-you-want-to-type = “full command you want to issue” For instance, since I learned to use DOS first, I frequently type DOS commands when I mean to use Linux. In DOS, to modify a file you type edit. For Linux I am supposed to type nano. This alias compensates for my trained fingers!
# .bashrc# Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi
# User specific aliases and functions alias sasmc='/sas/SASManagementConsole/9.4/sasmc &' alias edit='nano'
- Save the file and restart your session. You can type alias at the command line to see the available aliases (as shown above).
- Now, when you type edit the system quietly inserts nano and its just like holy water was applied!
Demons in My Closet
Most of the aliases I have added are to quickly access the SAS VA log directories. Your system paths may vary but it would be similar to this.
alias valog1 ='cd /sas_install/Lev1/Web/Logs/SASServer1_1'
alias valog12 = 'cd /sas_install/Lev1/Web/Logs/SASServer12_1'
alias slog = '/sas_install/Lev1/Web/WebServer/logs'
It is helpful to see the last log updated in the directory, so I added this command to see a long list sorted by time :
alias lst = 'ls -dt'
But then I thought it would be really cool if it would just show me the last 25 lines added to the last file updated in the directory. Tweak the 25 below if you want to see more lines. [Reference: Tail last file in directory]
alias tlst = 'tail -n25 "`ls -t | head -1`"
These are just some ideas to help speed things along for you. Here’s some examples of alias files I have collected from around the web. There are some cool ideas and some that must be specific to that user’s personal issues.
- A few more of my favorite shell aliases
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Helpful Aliases
If you are already have an optimized, efficient bashrc file suitable for SAS environments … what kind of demons do you use? Please speak up in the comments section below.
Post Administration: What Demons Are at Your Command? appeared first on BI Notes for SAS® Users. Go to BI Notes for SAS® Users to subscribe.


