Skip to content

Both.org

News, Opinion, Tutorials, and Community for Linux Users and SysAdmins

Primary Menu
  • About Us
  • Computers 101
    • Hardware 101
    • Operating Systems 101
  • End of 10 Events
    • Wake Forest, NC, — 2025-09-20
  • Linux
    • Why I use Linux
    • The real reason we use Linux
  • My Linux Books
    • systemd for Linux SysAdmins
    • Using and Administering Linux – Zero to SysAdmin: 2nd Edition
    • The Linux Philosophy for SysAdmins
    • Linux for Small Business Owners
    • Errata
      • Errata for The Linux Philosophy for SysAdmins
      • Errata for Using and Administering Linux — 1st Edition
      • Errata for Using and Administering Linux — 2nd Edition
  • Open Source Resources
    • What is Open Source?
    • What is Linux?
    • What is Open Source Software?
    • The Open Source Way
  • Write for us
    • Submission and Style guide
    • Advertising statement
  • Downloads
  • Home
  • 6 Linux metacharacters I love to use on the command line 
  • Command Line
  • Linux

6 Linux metacharacters I love to use on the command line 

Using metacharacters on the Linux command line is a great way to enhance productivity. Early in my Linux journey, I learned how to use the command line. It's what sets Linux apart. I could lose the graphical user interface (GUI), because it was unnecessary to rebuild the machine completely. Many Linux computers run headless, and you can accomplish all the administrative tasks on the command line. It uses many basic commands that all are familiar with—like ls, ls-l, ls-l, cd, pwd, top, and many more.
Don Watkins June 11, 2024 3 minutes read
linux_keyboard_desktop

Using metacharacters on the Linux command line is a great way to enhance productivity.

Early in my Linux journey, I learned how to use the command line. It’s what sets Linux apart. I could lose the graphical user interface (GUI), because it was unnecessary to rebuild the machine completely. Many Linux computers run headless, and you can accomplish all the administrative tasks on the command line. It uses many basic commands that all are familiar with—like ls, ls-l, ls-l, cd, pwd, top, and many more.

Shell metacharacters on Linux

You can extend each of those commands through the use of metacharacters. I didn’t know what you called them at first, but metacharacters have made my life easier.

Pipe |

Say that I want to know all the instances of Firefox running on my system. I can use the ps command with an -ef to list all instances of the programs running on my system. Now I’d like to see just those instances where Firefox is involved. I use one of my favorite metacharacters, the pipe | the result to grep, which searches for patterns. 

$ ps -ef | grep firefox 

Output redirection >

Another favorite metacharacter is the output redirection >. I use it to print the results of all the instances that Intel mentioned as a result of a dmesg command. You may find this helpful in hardware troubleshooting. 

$ dmesg | grep amd > amd.txt
$ cat amd.txt
[ 0.897] amd_uncore: 4 amd_df counters detected
[ 0.897] amd_uncore: 6 amd_l3 counters detected
[ 0.898] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4 counters/bank).

Asterisk *

The asterisk * or wildcard is a favorite when looking for files with the same extension—like .jpg or .png. I first change into the Picture directory on my system and use a command like the following: 

$ ls *.png
BlountScreenPicture.png
DisplaySettings.png
EbookStats.png
StrategicPlanMenu.png
Screenshot from 01-24 19-35-05.png

Tilde ~

The tilde ~ is a quick way to get back to your home directory on a Linux system by entering the following command: 

$ cd ~
$ pwd
/home/don

Dollar symbol $

The $ symbol as a metacharacter has different meanings. When used to match patterns, it means any string that ends with a given string. For example, when using both metacharacters | and $: 

$ ls | grep png$
BlountScreenPicture.png
DisplaySettings.png
EbookStats.png
StrategicPlanMenu.png
Screenshot from 01-24 19-35-05.png

Caret ^

The ^ symbol restricts results to items that start with a given string. For example, when using both metacharacters | and ^: 

$ ls | grep ^Screen
Screenshot from 01-24 19-35-05.png

Many of these metacharacters are a gateway to regular expressions, so there’s much more to explore. What are your favorite Linux metacharacters, and how are they saving your work?

Tags: CLI Linux Metacharacters

Post navigation

Previous: Running FreeDOS on Linux
Next: Using the command line calendar and date functions in Linux

Related Stories

wfh_work_home_laptop_work
  • Advanced
  • Command Line
  • Linux
  • Tools

Beyond the Basics: Advanced Text Processing with awk and sed

Saikat Goswami May 8, 2026
retro_old_unix_computer
  • Fortran 77
  • Linux
  • Programming

5 things to know when learning FORTRAN 77

Jim Hall May 6, 2026
zen_rocks_stack_blue_yoga_peace
  • Command Line
  • Humor
  • Linux 101

Using the force at the Linux command line

Alan Formy-Duval May 4, 2026

Random Quote

Unix never says ‘please’.

— Rob Pike

Why I’ve Never Used Windows

On February 12 I gave a presentation at the Triangle Linux Users Group (TriLUG) about why I use Linux and why I’ve never used Windows.

Here’s the link to the video: https://www.youtube.com/live/uCK_haOXPFM 

Why there’s no such thing as AI

Last October at All Things Open (ATO) I was interviewed by Jason Hibbits of We Love Open Source. It’s posted in the article “Why today’s AI isn’t intelligent (yet)“.

Technically We Write — Our Partner Site

Our partner site, Technically We Write, has published a number of articles from several contributors to Both.org. Check them out.

Technically We Write is a community of technical writers, technical editors, copyeditors, web content writers, and all other roles in technical communication.

Subscribe to Both.org

To comment on articles, you must have an account.

Send your desired user ID, first and last name, and an email address for login (this must be the same email address used to register) to subscribe@both.org with “Subscribe” as the subject line.

You’ll receive a confirmation of your subscription with your initial password as soon as we are able to process it.

Administration

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

License and AI Statements

Both.org aims to publish everything under a Creative Commons Attribution ShareAlike license. Some items may be published under a different license. You are responsible to verify permissions before reusing content from this website.

The opinions expressed are those of the individual authors, not Both.org.

You may not use this content to train AI.

 

Advertising Statement

Both.org does not sell advertising on this website.


Advertising may keep most websites running—but at Both.org, we’re committed to keeping our corner of the web ad-free. Both.org does not sell advertising on the website. Nor do we offer sponsored articles at this time. We’ll update this page if our position on sponsorships changes.

We want to be open about how the website is funded. Both.org is supported entirely by David Both and a few other dedicated individuals.

 

 

Copyright © All rights reserved. | MoreNews by AF themes.