Whenever you run a command in a shell, any programs that it starts up are added to a “job”. You can do various things with these jobs, of which we’ll describe a few here.
It’s very common to want to run more than one program at the same time, or to temporarily stop running a program and resume it later. This section will teach you how to do that.
The job you are currently running and interacting with is known as the foreground job. Any other job you are running is known as a background job.
If you’re working in python
, coin
, bash
or any other program that
repeatedly gets input from you while it’s running, you can almost always make
the program exit by pressing ^D
(or end of file, commonly abbreviated EOF).
These types of programs are called REPLs (read-eval-print-loop). They do exactly
what their name says: read input from a user, evaluate it in some way, print the
results of evaluating, and repeat the process. They stop when there is no more
input, which you can signal by pressing ^D
.
To ask a program to stop running, type ^C
. (This may not always make
the program quit immediately, but will in the majority of cases.)
Some programs can ignore the ^C
signal. If this is the case, you have to hard
quit the program using the kill
command. kill
has two forms:
You’ve already seen how to get the job numbers with jobs
. To get process IDs,
you can run
There will come a time when you’re not sure how to do something on a terminal. In those cases, you’ll want to get help on how to do it. Thankfully, there are several useful resources to provide you with help.
man
(short for “manual”) is one of the most commonly used help resources. You
can type
to get information on what a command does and what options you can give it.
/thing_i_want_to_find
(note the
slash at the beginning)n
man
by pressing q
.--help
flagMost (not all) commands have a --help
or -h
option that will print
out a message about how to use it. This message is generally shorter and
easier to read through than the man page.
You can also use Google to look for answers to questions that are not as easily
answered by man
. StackOverflow tends to be a very good resource to answer
questions. It’s important to be careful with Googling, since some answers are
wrong or overly complicated.
A symbolic link is a special kind of file that contains a reference to another file. You can use symbolic links to create short names to refer to files in another directory. For example,
ln
has a lot of options and forms, but when you just want to make a file link
to another file or directory, the syntax is
This can be hard to remember. I personally find it easy to think about it in
terms of the “arrow” that effectively gets drawn by linking one file to another.
When using ls -l
, the direction of this arrow is forward (->), but when using
the ln -s
command to create links, the arrow points backwards.