/ factorpad.com / tech / linux-essentials / type-command.html
An ad-free and cookie-free website.
Beginner
Learn to find a file's type and location at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux type Command Summary with Examples (4:02)
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.
-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.
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
.
Ok, it's a builtin. Next, let's pass multiple arguments, from our four previous videos.
Now, up arrow, add the -t
option and
compare.
See, shorter types, for the descriptions. Next, let's get command types
and locations using -a
.
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.
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.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Like what you see? Subscribe, follow and tell a friend.
cat
command,
hit Back.alias
command, click Next./ factorpad.com / tech / linux-essentials / type-command.html
A newly-updated free resource. Connect and refer a friend today.