Basic Functions

Background Tasks

You can run tasks in the background within a terminal window by placing an & at the end of the command you want running. You can see these background jobs with jobs and kill the job that you want with kill % followed by the index, or just kill % to kill all jobs.

Event Designators

An event designator is a reference to a command line entry in the history list. Unless the reference is absolute, events are relative to the current position in the history list.


WIthin your ~/.bashrc file, add this line and populate it how you need:

alias alias_name="command_to_run"

# e.g.
alias poo="say 'I have to poop really bad'"

When complete, run source ~/.bashrc or source ~/.zshrc and restart bash to have them take effect.


To connect the STDOUT of one command to the STDIN of another use the | symbol, commonly known as a pipe.

# long way
$ thing1 > tempfile
$ thing2 < tempfile

# shorter
$ thing1 > tempfile && thing2 < tempfile

# shortest
$ thing1 | thing2


base64 path/to/file > output.txt will encode whatever file into base64.

echo -n 'some string' | base64 > output.txt will encode a string as input and not encode unusable chars, like line feeds.

The --decode flag may be added to reverse this process.


Errors from Windows

If you got a script that looks totally fine but is throwing errors that make very little to no sense, like failing cd and cp, it's probably containing \r from a Windows computer.

tr -d "\r" < >



Last modified: 202107281718