Unix How-To: More Alias Quickies to Save You Time

By Sandra Henry-Stocker  Add a new comment

Today's column is a grab bag of useful aliases that will save you some precious typing time. The sysadmins I know like to type as few characters as possible, so many of these are especially terse.

The first alias serves as a command "preface". That is, type the alias, follow it with an argument and you're good to go. It runs the ps command, sends the output to grep and expects you to provide the string to be used in the search. Thus, we call it "psg" for "ps" and "grep".

alias psg="ps -ef ¦ grep "

You can use this alias to search for applications and users. You might type "psg httpd" to view apache or "psg squarepants" to list all of Bob's jobs.

Another alias of the preface variety is this find command. Instead of trying to teach your users which argument comes where in the find command, you can have them type just ff followed by the name (or regular expression) for the file(s) they're looking for.

alias ff="find . -type f -name "

The next alias lists all files with their inode numbers. Another two-letter alias.

alias li="ls -li | sort -n | more"

This alias lists your files a screen at a time. You get a long listing and include "hidden" files by typing just two characters.

alias lm="ls -al | more"

The usage alias goes a little further than the findbig alias presented in an earlier column (found the five largest files). It lists the sizes in blocks of all your files and sorts them in size order.

alias usage="du -skc * | sort -rn | more"

If you find that you're frequently listing the contents of files in some particular directory, you can assign an alias with an obvious name to do the job. This one shows the files with the most recently updated documents last in the list (so they'll be the ones you'll notice right away).

alias html="ls -ltr /usr/local/apache/htdocs"

If you turn forwarding on and off fairly routinely, you can create aliases that move your .forward file to an inactive status (by changing its name) and then back again.

alias forward='mv forward .forward'
alias stayput='mv .forward forward'

Here's a nice alias for lisitng directories only:

alias lsDir='ls -d */'

And, finally, here's an alias to greet you when you're working late and feeling
lonely.

alias hello="echo Hello, $USER. What are you doing here on a `date +%A`?"

ITworld LIVE

IT Management/StrategyWhite Papers & Webcasts

White Paper

The Cloud: Reinventing Enterprise Collaboration

Collaboration and content sharing are not, of course, new concepts. But cloud computing has changed the nature of collaboration, content sharing, document storage and project management to enable more efficient, faster-acting and cost-effective enterprises. According to a new study by IDG Research, the vast majority of knowledge workers (86%) placed a very high level of importance on collaborating with internal coworkers and external stakeholders, and having access to the most up-to-date corporate information. Read how organizations are realizing massive productivity gains by transitioning their content management solutions to cloud-based models.

White Paper

Empowering Your Mobile Worker

Today's most productive employees are mobile, and your company's IT strategy must be ready to support them with 24/7 access to the business information they need across a range of mobile devices.See how corporations are meeting the many needs of their mobile workers with the help of Box.

White Paper

Market Landscape Report: Online File Sharing and Collaboration in the Enterprise

The trend toward "consumerization" marches onward in IT; more and more end-users are choosing their own hardware plaforms and software applications in lieu of the IT-sanctioned business tools provided by their companies. These end-users are looking to tackle issues like data sharing, portability, and access from multiple intelligent endpoint devices, creating a conundrum for IT as it needs to balance business enablement, ease of access, and collaborative capacity with the need to maintain control and security of information assets. This need for balance is one of the drivers of the fast growing online file sharing and collaboration segment of the SaaS market. This paper examines the market drivers, inhibitors, and top vendors in this segment, including Box, Citrix Sharefile, Dropbox, Egnyte, Nomadesk, Sugarsync, Syncplicity and YouSendIt.

White Paper

Sharing Simplified - Consolidating File-sharing Technologies

Employees need to share content with colleagues within their organization and outside. Yet, ECMs make it hard to share content within a business and impossible between organizations. Read how one company consolidated multiple file sharing technologies to increase productivity and reduce complexity.

White Paper

Content Sharing 2.0: The Road Ahead

A growing number of companies are taking advantage of the natural synergies that exist between cloud-based IT services and content access and sharing. Legacy content management and collaboration systems simply weren't designed to meet the evolving requirements of today's IT and business managers, as well as the needs of content users. Box provides cloud-based content storage, access and collaboration services that require virtually no user training and supports file access and delivery on almost all popular PC and mobile devices. Read how Box let companies rapidly implement a cost-effective and secure content storage and sharing system that can easily expand to accommodate any size and number of files.

See more White Papers | Webcasts

Ask a question

Ask a Question