Features of the TCSH Shell
Many operations in the shell work on many files, e.g., all files ending with .tex or starting with test-. TCSH has the ability to type all these files for you, with file patterns. The following list shows which possibilities exist:
* | Match any number of characters |
? | Match a single character |
[...] | Match any single character in the list |
[x-y] | Match any character within the range of characters from x to y |
[^...] | Match elements which do not match the list |
{...} | This expands to all the words listed. There's no need that they match |
^... | ^ in the beginning of a pattern negates the pattern |
*.tex: match all files ending with .tex
^*.tex: match all files which does not end with .tex
xxx{ab,cde,hifj}yy: match xxxabyy xxxcdeyy and xxxhifjyy
*.[ch] or *.{c,h}: match all .c and .h files
An important thing to be aware of is that it is the shell which expands the patterns, and not the program, which is executed with the pattern.
An example of this is the program mcopy which copies files from disk. To copy all files, you may wish to use a asterisk, as in: mcopy a:* /tmp. However, this does not work, since the shell will try to expand the asterisk. Since it cannot find any files which start with a:, it will signal an error. So if you wish to send a asterisk to the program, you have to escape the asterisk: mcopy a:\* .
There are two very useful key bindings which can be used with patterns. The first is C-xg, which lists all the files matching the pattern, without executing the command. The other is C-x*, which expands the asterisk on the command line. This is especially useful if you wish to delete all files ending in .c except important.c, stable.c and another.c. Creating a pattern for this might be very hard, so just use the pattern *.c. Then type C-x*, which will expand *.c to all your .c files. Now it's easy to remove the three files from the list.
When using the shell, you will soon recognize that certain commands are typed again and again. One of the top ten is surely ls -la, which lists all files in a directory in long form.
TCSH has a mechanism to create aliases for commands. This means that you can create an alias for ls -la called la.
Aliases may refer to the arguments of the command line. This means that you can create a command called pack which takes a directory name and packs the directory with tar and gz.
Aliases can be a bit hard to create since you often want history/variable references expanded at the time of use, not at the definition time. This can be done more easily with TDG; go to the page aliases to define aliases. If you end up with an alias you cannot define on this page, but you can in TCSH, please send me e-mail (blackie@imada.ou.dk). For more information about aliases, see the TCSH manual at http://www.imada.ou.dk/Technical/Manpages/tcsh/Alias_substitution.html.
Have you ever needed to know how long a program took to run, i.e., how much CPU it used? If so, you may recognize the output from the TCSH built-in time command:
0.020u 0.040s 0:00.11 54.5% 0+0k 0+0io 21pf+0w
Informative? Yes but... the GNU time command is a bit more understandable:
0.01user 0.08system 0:00.32elapsed 28%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+0minor)pagefaults 0swapsIn TDG you can configure the output from the time command on the page called jobs shown in Figure 5.
As you may have guessed, TDG and this article will help you a lot in the use of TCSH, but you may need to read a bit more to get even more out of TCSH. Here are a few references:
The TCSH manual page at http://www.imada.ou.dk/Technical/Manpages/tcsh/top.html
Using csh & tcsh by Paul DuBois, published by O'Reilly & Associates, 1995: http://www.primate.wisc.edu/software/csh-tcsh-book/
The TCSH mailing list at tcsh@mx.gw.comr (to join send mail to listserv@mx.gw.com with body text SUBscribe TCSH your name)
Jesper Pedersen lives in Odense, Denmark, where he has studied computer science at Odense University since 1990. He is a system manager at the university and also teaches computer science. He is very proud of his “child”, The Dotfile Generator, which he wrote as part of his job at the university. In his spare time, he does Jiu-Jitsu, listens to music, drinks beer and has fun with his girlfriend. He loves pets, and has a 200 litre aquarium and two very cute rabbits. His home page can be found at http://www.imada.ou.dk/~blackie/“, and he can be reached at blackie@imada.ou.dk. This article first appeared in Issue 12 of Linux Gazette.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Designing Electronics with Linux
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Dynamic DNS—an Object Lesson in Problem Solving
- New Products
- Using Salt Stack and Vagrant for Drupal Development
- Validate an E-Mail Address with PHP, the Right Way
- Build a Skype Server for Your Home Phone System
- A Topic for Discussion - Open Source Feature-Richness?
- Why Python?
- Tech Tip: Really Simple HTTP Server with Python




1 hour 28 min ago
5 hours 15 min ago
5 hours 23 min ago
7 hours 38 min ago
10 hours 7 min ago
20 hours 10 min ago
1 day 37 min ago
1 day 4 hours ago
1 day 4 hours ago
1 day 7 hours ago