FactorPad
Build a Better Process

Linux type Command Summary with Examples

Linux type allows you to show a command's type and location.
  1. Purpose - Learn what type is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with type.
  4. A tip - Finish off with one more insight.
face pic by Paul Alan Davis, CFA
Updated: February 23, 2021
In this tutorial on Linux type, 11 of 10, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / type-command.html


An ad-free and cookie-free website.


The Linux type command

Beginner

Learn to find a file's type and location at the Linux command line.

Video Tutorial

Videos can also be accessed from the Linux Essentials Playlist on YouTube.

Linux type Command Summary with Examples (4:02)

Video Script

The Command and Why You Need It

Our eleventh word, or command to memorize is type from the category Help.

type allows you to show a command's type and location. In our last video we wanted to send output to a file instead of the screen. So here we'll use the type command to do that.

Common Linux type Options
-options description
-a Display type and locations
-t Display single word file type

Before we start, it helps to think of commands as mini programs and most follow this structure: command -option(s) argument(s).

The type command has 5 options, and arguments you provide are the commands you're interested in learning about.

Let's discuss three command types: first, the 60 or so bash shell builtins we saw in video 9. Second is a vast group of non-shell commands. Third, are aliases which we will cover in our next video.

To access types, we'll go option-less, and use the -t option. The second capability is to add locations, using the -a option.

So why is type an important command? Well, type is a nice way to start your search for help. And now you know how to do that.

Demonstration

Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go, start with an easy one, type type.

$ type type type is a shell builtin

Ok, it's a builtin. Next, let's pass multiple arguments, from our four previous videos.

$ type ls cd bash cat ls is aliased to `ls --color=auto' cd is a shell builtin bash is /bin/bash cat is hashed (/bin/cat)

Now, up arrow, add the -t option and compare.

$ type -t ls cd bash cat alias builtin file file

See, shorter types, for the descriptions. Next, let's get command types and locations using -a.

$ type -a ls cd bash cat ls is aliased to `ls --color=auto' ls is /bin/ls cd is a shell builtin bash is /bin/bash cat is /bin/cat

And last, let's tackle the problem from the last video and create a file with the same output. Find the command with up arrow, and redirect output with this symbol >, a file name and examine.

$ type ls cd bash cat > video11.txt $ cat video11.txt ls is aliased to `ls --color=auto' cd is a shell builtin bash is /bin/bash cat is hashed (/bin/cat)

A Final Tip

Okay now you know how to use type. And you know the syntax for commands, options and arguments.

One last tip about the type command. So we touched on alias here but didn't explore it, so tune in for our next video. Later, we'll also discuss a fourth command type called a function.

Okay, thanks for visiting today. I hope this was a fun introduction to the type command.


Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:


What's Next?

Like what you see? Subscribe, follow and tell a friend.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / type-command.html


linux type command
type command
type linux
type command linux
linux type examples
find files
find commands
file types
alias type
hashed type
builtin type
bash file types

A newly-updated free resource. Connect and refer a friend today.