Categories
Linux Tutorial Series

Linux Tutorial Series – 62 – Command types

Here is the video version, if you prefer it:

There are 4 types of Linux commands (Shotts, 2019)⁠:

  • executable programs (called executables for short) – programs that are written in a programming language (either a so-called compiled programming language or an interpreted programming language)
  • a command built into the shell itself (shell builtin) (such as echo)
  • shell functions (miniature shell scripts)
  • aliases (commands which we define ourselves which are composed of other commands)

Why is this useful to know? Well, let’s say that you type in ll into your Terminal and get the following error:

mislav@mislavovo-racunalo:~/Linux_folder$ ll

bash: ll: command not found

Ooops! What just happened? bash tells me it didn’t find the command ll. How could this be? Well, it is because ll is an alias for ls -l, which I can execute:

mislav@mislavovo-racunalo:~/Linux_folder$ ls -l

total 20

-rw-r--r-- 1 mislav mislav 63 Jan 13 05:17 aba.txt

-rw-r--r-- 1 mislav mislav 0 Jan 11 23:00 aba.txt~

-rw-r--r-- 1 mislav mislav 12 Jan 13 05:17 ab.txt

-rw-r--r-- 1 mislav mislav 0 Jan 11 23:00 ab.txt~

-rw-r--r-- 1 mislav mislav 26 Jan 13 05:18 a.txt

-rw-r--r-- 1 mislav mislav 0 Jan 11 23:00 a.txt~

-rw-r--r-- 1 mislav mislav 40 Jan 13 05:18 cb.txt

-rw-r--r-- 1 mislav mislav 0 Jan 11 23:00 cb.txt~

-rw-r--r-- 1 mislav mislav 26 Jan 11 22:18 file.txt

If I hadn’t known ll is an alias, I might have thought I am lacking some executable. Moreover, I can define my own ll alias which shortens my typing session.

Hope you learned something useful!

References

Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Page 66

NewsletterUpdates on interesting things I am doing

Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.

Leave a Reply

Your email address will not be published. Required fields are marked *