Has this ever happened to you? You’re sitting at a UNIX terminal, and you can’t remember the command to make a text file listing the files in your directory. Or maybe you want to delete a directory and all the empty directories above it. Here’s your solution. We’ve prepared a download that features a collection of UNIX commands, descriptions, examples, and explanations that can help you easily navigate and use the UNIX system to its fullest. This set of “cheat sheets” enables you to quickly find the command you need without fighting your way through the dreaded “man pages.” A few examples from the UNIX cheat sheets are shown below.

Extract lines from a file using a keyword

grep string file Searches input file(s) for specified string and prints the line with matches. grep mike letter Searches for the string mike in the file named letter and prints any line with mike in it to the screen.
grep -c string file Searches and prints only the number of matches to the screen. grep -c hayes bankletter Searches the file bankletter for the string hayes and prints the number of matches to the screen.
grep -i string file Searches without regard to letter case. grep -i hi file1 Searches file1 for hi, Hi, hI, and HI and prints all matches to the screen.
grep -n string file Prints to the screen preceded by the line number. grep -n abc alpha Searches alpha for abc and prints the matches’ lines and line numbers to the screen.
grep -v string file All lines that do not match are printed. grep -v lead pencils Prints all lines in pencils that do not contain the string lead.
grep -x string file Only exact matches are printed. grep -x time meetings Prints only lines in meetings that match time exactly.

Download our UNIX command cheat sheets
You can download the complete set of UNIX command cheat sheets by following this link or by clicking on the Downloads link in the navigation bar on the top of this page. TechRepublic has many useful documents, templates, and applications available for download, so be sure to check out our other offerings.

Our UNIX command cheat sheets download is available both as a Microsoft Word document and an Adobe PDF file. To increase download speed, we have zipped these two files together into one file named unix_commands.zip. You will need an unzip utility such as WinZip or PKZIP to expand the zipped file. You will also need either Microsoft Word or the Adobe Acrobat Reader to view each respective document. You can download the Adobe Acrobat Reader here.
Tell us what you think about this download. We’d like to hear your comments and suggestions, so send us a note.