- End a text program
that is hanging (i.e. in an infinite loop)
Press ctrl-c (with the correct terminal in the foreground). This can
often, but not always be used to escape from interactive programs as
- End a misbehaving
ps to find its process id (also printed in
terminal when programs started), then
]. Despite the name,
this asks the program nicely to end. If it doesn't work, try
-9 [PROCESS ID] which forces it to end.
- Run a graphical
programs from the command line
Add an ampersand (&) at the end of the command to fork
the process (run the program in a new process).
I you do this, you can
press enter to get a prompt and continue using the terminal. If you
don't, the prompt won't return until you close the program or enter
ctrl-c, and closing the terminal also kills the graphical program.
$ PROGRAM [OPTIONS] [I/O REDIRECTION] &
- Take advantage of the
Press the up key to recover the most recent command. Use up and down
to scroll through the entire history.
- Take advantage of
When entering a command name or filepath, type just the first few
characters and press tab to have the shell attempt to complete it. If
there are multiple possibilities, the shell will display them. Type a
few more characters and press tab again, repeating as necessary. Once
you get the hang of it, this makes dealing with long path names much
Useful Text Programs
- mail -- send text via email
- Text body only, from a file:
$ mail ADDRESS -s "
- Short text body only:
$ echo "EMAIL BODY" | mail ADDRESS -s "SUBJECT"
- mutt -- send attachments via email
- Short body plus attachment:
$ echo "
" | mutt ADDRESS
" -a ATTACHMENT
- Create aliases for common commands.
Edit the ".aliases" file in your home directory. Follow the format used
for the existing aliases.
- Enable file/folder coloring with "ls"
Edit the ".aliases" file and add the following entry to the top (before
any commands that use "ls"):
This makes navigation somewhat easier.
$ alias ls 'ls --color=auto'
Last updated 12/22/12