RSS 피드 구독하기

When I first became a sysadmin, I was shocked by the speed and precision that my senior colleagues showed when doing basic tasks inside a given terminal or system. These guys would load up bash keys and have a full-stack health check completed inside of five seconds; all the while, I was still trying to enter the initial SSH keys so that I could even start my work. I knew I was competent on the keyboard and quick to pick up new commands that helped simplify my routine tasks, but I was clearly missing something. I finally pushed past my fear of being the FNG (military-speak for "new guy") and asked the question: "What are you all using to speed through these commands?" Whatever it was, it was clearly automated. That was when a good friend introduced me to a simple but effective tool: AutoHotkey.

AutoHotkey is a free open source tool that's used to script a variety of tasks. Anything, from keyboard shortcuts to launch your favorite browser or keystroke and mouse emulation, can be accomplished with this approachable application. With a detailed and well-thought-out how-to, this tool is something that can be used by senior developers and junior admins alike. All that is needed is a text file containing your scripted shortcuts with the correct file extension (all of this is explained in the how-to that comes along with the AutoHotkey download). Allow me to demonstrate the utility that is on offer here.

For basic, everyday phrases that you use with your customers and co-workers, you might type something like this into your hotkey.ahk file:

---
::gm::good morning!
Return

With the script active, this addition would allow you to enter the gm and good morning! would appear, similar to how we communicate over text but in a professional environment. This next example is a personal favorite of mine, as I am a coffee fiend: 

---
::coffee::be right back, going to grab coffee
Return

As before, the portion contained within the double colon is your keyword. The portion after would be displayed on the screen after hitting the Return/Enter key. Both of these examples are great when used in a conversational context, be it Bluejeans or another conferencing tool. 

At this point, you may be thinking to yourself, "That is just lazy." And, if that is all the program could offer, you would be right. However, this is where the app really earns its keep. For technical or work-related tasks, such as loading SSH keys for a particular user in a terminal, you can script something like: 

---
:://adminkey::ssh-agent bash{Enter}ssh-add /home/admin/.ssh/admin_key{Enter}unset TMOUT{Enter}TERM=xterm-color{Enter}
Return

The simple string //adminkey (Enter) would effectively load your bash and user key, followed by unsetting the timeout value for your login and adding color filters to your terminal (which I find very useful). The other thing that I find myself routinely using is the ability to reduce a long file path down to a few simple letters or keystrokes. 

In this example, we will change directories (cd) to /usr/local/*****/var/mc/server_data/prefs/, which contains a configuration file that I often need to reference in my current position. The file path /usr/local/*****/var/mc/server_data/prefs/ can be shortened to mcprefs.

That script would look something like this:

---
::mcprefs::/usr/local/*****/var/mc/server_data/prefs/
Return

AutoHotkey is a great tool that can be powerful when tuned correctly and can act as a sort of "gateway drug" to further interest in automation solutions (see our articles on Ansible). This tool can be used on an individual basis, and at the end of the day, it will increase your overall efficiency with the time that you are given. When we as sysadmins automate even the simplest of tasks, we increase the amount of time that we can now spend on other things—things like professional development, family time, or perfecting that oatmeal porter you’ve been brewing! Either way, it’s a win in my book.


저자 소개

Tyler is the Sr. Community Manager at Enable Sysadmin, a submarine veteran, and an all-round tech enthusiast! He was first introduced to Red Hat in 2012 by way of a Red Hat Enterprise Linux-based combat system inside the USS Georgia Missile Control Center. Now that he has surfaced, he lives with his wife and son near Raleigh, where he worked as a data storage engineer before finding his way to the Red Hat team. He has written numerous technical documents, from military procedures to knowledgebase articles and even some training curricula. In his free time, he blends a passion for hiking, climbing, and bushcraft with video games and computer building. He is loves to read and enjoy a scotch or bourbon. Find him on Twitter or on LinkedIn.

Read full bio
UI_Icon-Red_Hat-Close-A-Black-RGB

채널별 검색

automation icon

오토메이션

기술, 팀, 인프라를 위한 IT 자동화 최신 동향

AI icon

인공지능

고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

open hybrid cloud icon

오픈 하이브리드 클라우드

하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Virtualization icon

가상화

온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래