Skip to Content
Navigation:

A stick figure smiling

Here's a preview from my zine, Bite Size Bash!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

Image of a comic. To read the full HTML alt text, click "read the transcript".

browse more comics! get the zine!
read the transcript!

most bash commands are programs

You can run which to find out which binary is being used for a program:

$ which ls 
/bin/ls
````

### but some commands are functions inside the bash program
smiling stick figure with short curly hair: `$ echo hi`   
bash, represented by a box with a smiley face: ooh, echo? I'll call my builtin function that does that!

### type tells you if a command is a builtin

$ type grep grep is /bin/grep $ type echo echo is a builtin $ type cd cd is a builtin ```

examples of builtins

  • declare
  • type
  • source
  • alias
  • read
  • cd
  • printf
  • echo

a useful builtin: alias

alias lets you set up shorthand commands, like:
alias gc="git commit"

~/.bashrc runs when bash starts, put aliases there!

a useful builtin: source

bash script.sh runs script.sh in a subprocess, so you can’t use its variables / functions.

source script.sh is like pasting the contents of script.sh

Saturday Morning Comics!

Want another comic like this in your email every Saturday? Sign up here!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2024 | All rights reserved (see the FAQ for notes about licensing)