Fall 2008
- Mon, Sep 8, 4pm, Math 101, Remote Connection, SSH, and VNC, by Joe McMahon
- Mon, Sep 15, 4pm, Math 102, An introduction to LaTeX and Beamer, by Kevin LaTourette
- Mon, Oct 13, 4pm, Math 101, Paradigm Shifts in Science Based Simulations, by Mac Hyman
- Mon, Oct 27, 4pm, Math 101, SQL for Joy: All your database are belong to us, by Karl Newell
For more details, and talks in past semesters, consult the
full schedule of talks.
Tentative talks:
- Scripting with Bash
- Power Point presentation using LaTeX
- GNU/Linux text editors
Interested in speaking?
Past topics can (and should) be repeated
occasionally. In addition,
here are some topics people might like to hear about:
- Femlab (PDE modeling environment)
- GAP (computer algebra software)
- Getting started with Maple (or Matlab, or Mathematica, ...)
- How to do math on a Mac
- How to filter e-mail spam
- HTML vs. XHTML (the new HTML standard)
- Octave (free Matlab-like system)
- PDAs (handheld personal digital assistants and much more)
- PHP (server-side webpage scripting)
- R (free statistics system)
- Remote access (SSH, VNC, dial-up, ...)
- Scientific WorkPlace (graphical front end to TeX)
- Setting up a dual boot system (DOS/Linux)
- TeX / LaTeX topics
- Using scanners efficiently
- Using the WINEDT editor (a front end to TeX, HTML)
- XML (extensible markup language)
- [your favorite topic here]
To give a talk, please contact
swig@math.arizona.edu.
Basic Linux commands
Robert Lakatos • 2006
Contents
Useful websites
Account management
Exiting from a shell prompt (to close a terminal window or to log out)
- exit
- or by pressing <ctrl+d> — the general end of text control character.
Filesystem navigation
We have a tutorial on manipulating files.
- pwd [options] — to obtain/print the name of your current/working directory.
- cd [options] [directoryname | ~ | ./ | ../ | - ] — to change your working directory.
Examples:
- cd /tmp: uses an absolute path
- cd ~: go to your home directory
- cd ./subdir: uses a relative path
- cd ..: go to the parent directory of the current directory
- cd -: go to the last directory you were in before this one (i.e. go back),
with one level of undo. See also the on-line documentation for the
pushd, popd, and dirs commands.
- ls [options] directoryname — to list the contents of directories.
Some useful options (see man ls for more):
- ls -l: long listing.
- ls -d */: show only subdirectories of the current directory; don't show files.
- ls -a: show files beginning with a ., which aren't otherwise shown.
- ls -lrt: show files sorted by modification time, newest last.
- ls -lrS: show files sorted by size, biggest last.
- mkdir [options] directoryname — to create new directories.
- rmdir [options] directoryname — to remove/delete directories.
- cp [options] source destination — to copy files and directories.
- mv [options] source destination — to move files and directories.
- rm [options] filenamelist — to remove/delete files.
Searching for files by name
- locate [options] <searchstring>
- find [options] <searchstring>
Searching through contents of files
- grep [options] <searchstring>
Examples:
- grep -i diffeomorphism *.tex: case-insensitive search
- grep -w diffeomorphism *.tex: match word boundaries, i.e.
a line with diffeomorphisms but not diffeomorphism
won't be printed.
- grep -l diffeomorphism *.tex: show only the names of the files
with desired contents, but don't show all the lines themselves.
Determining file types
Viewing text files
- cat [options] filename — to display the file contents without pause or break.
- less [options] filename — to display file contents page by page.
- more [options] filename — to display file contents page by page.
- head [options] filename — to display the first few lines of a file.
Example: head -20 thesis.tex shows the first 20 lines of thesis.tex.
- tail [options] filename — to display the last few lines of a file.
Example: tail -20 thesis.tex shows the last 20 lines of thesis.tex.
Editing text files
- To edit a text file type: editorname filename [&], where editorname could be one of the following: GNU-emacs, vi, joe, pico, etc. (note: change these links to the internal editor site)
Compressing and decompressing files
| File extension |
Compression command |
Decompression command |
| .gz |
gzip |
gunzip or gzip -d |
| .bz2 |
bzip2 or bzip2 -d |
bunzip2 |
| .zip |
zip |
unzip |
| .Z |
compress |
uncompress |
Reading compressed text files
- zless [options] compressedfilename — to display the
contents page by page without uncompressing the file.
Archiving (packaging) files and directories
- tar [options] filenamelist archive.tar — to archive files
(store and extract). Compression and decompression is available in the
following formats: .bz2(.bz) or .gz.
Examples:
- tar zcf rtg_project.tgz rtg_project: package up the directory
called rtg_project, putting a copy of everything into the
compressed tar file rtg_project.tgz. Now you can put this
file on a thumb drive, e-mail it to someone across the country, etc. etc.
The c is for create.
- tar ztf rtg_project.tgz: List out the contents of
the compressed tar file rtg_project.tgz, just to see what's in it.
The t is for table of contents.
- tar zxf rtg_project.tgz: Extract the contents of
the compressed tar file rtg_project.tgz. Warning: this may
overwrite existing files with the same name, if any are present.
The x is for extract.
- cpio [options] filenamelist — to copy files to and from
an archive.
- zip / unzip [options] archivename.zip filenamelist — to
package and unpackeage compressed archives.
- zoo [options] archive filename — to create and maintain
collections of files in compressed form.
Managing print jobs
- lpr [options] filenames... — to print files.
- lpq [options] — to check printer que status.
- lprm [options] printjobIDs — to cancel print jobs.
Using floppy diskettes and CD-ROMs
- mount /mnt/floppy — to mount floppies.
- mount /mnt/cdrom — to mount CD-ROMs.
- umount /mnt/floppy — to unmount floppies.
- umount /mnt/cdrom — to unmount CD-ROMs.
- mkisofs [options] filename [specifications] — to create a binary ISO image file.
- cdrecord [options] tracks... — to record audio or data compact discs.
- mtools — alternative file manipulation commands for DOS disks. Instead of mounting a disk, with the mount command as above, and using standard Linux commands like cp, ls, mv, etc. one can use the mtool commands to manipulate files. Consult man mtools for information about these commands.
Remote access
- ssh [options] user[@host] — to make secure shell connections.
Example: ssh -X rlakatos@gila.math.arizona.edu.
The -X option allows you to run graphical-interface programs, as
long as you're ssh'ing from a Un*x-like machine (e.g. another Linux machine).
- scp [options] [user1@host1]:filenames...
user2@host2:filenames... — to
securely copy individual files.
Examples:
- scp myfile.txt rlakatos@gila.math.arizona.edu:tmp:
Copy myfile.txt on the current machine to ~/tmp on host gila.
- scp myfile.txt rlakatos@gila.math.arizona.edu:/tmp:
Copy myfile.txt on the current machine to /tmp on host gila.
- scp rlakatos@gila.math.arizona.edu:/tmp/myfile.txt .:
Copy myfile.txt on host gila to the current machine.
- sftp [options] [user]@host — to start a powerful interactive secure file transfer program.
Running applications in the background
- nohup commandname [arguments] — to run a command, with a
non-tty output, that should continue running after exiting the prompt.
- nice [options] commandname [arguments] — to run a program
with modified scheduling priority.
- renice priority [options] — to alter the priority of a
running process.
- & — to put a job in the background (for example
emacs mytext.txt &).
- bg [jobspec] — to resume the suspended job
jobspec in the background as if it had been started with &.
- fg [jobspec] — to put the specified job in the foreground
(to make it the current job).
Processes and disk space
- ps [options] — to display active proccesses.
- kill [options] processID — to send a signal to a process
("kill" is a misnomer).
- top [options] — to display top CPU processes.
- free [options] — to display information about free and
used memory on the system.
- df [options] file(system)name — to get information on
filesystem disk space usage.
- du [options]filename — to estimate file space usage.
Example: du -s ~/* ~/.* | sort -r: find which subdirectories
of your home directory are using up the most space.
Command-line history, I/O redirection, and piping
- history [options] — to display the command line
history.
- <tab> key — to complete a partially typed
file/directory name or command.
- <↑> / <↓> keys — to
navigate the command history buffer.
- ; — to separate multiple commands on a single line. For
example command1 ; command2.
- >,>> — to redirect the output of a command. For
example ls -la directoryname > myfile.txt will write the output of
the ls command to the file myfile.txt (and not to the
screen!) while overwriting any previous contents of the file. If
>> is used instead of > the original contents of
the file myfile.txt will not be ereased but the output of
ls will be appended to it.
- < — to use a specific file as an input to a command.
For example cpio [options] < filenamelistfile.txt
- | — to pipe the output of one command to another command.
For example ls -al directoryname | less.
Miscellaneous
- date [options] — to display and set the system date and
time.
- clear — to clear the terminal window.
- reset [options] — to reset the terminal window to its
default display settings.
Starting applications
- To launch an application from a shell prompt simply type the name of the application at the prompt.
Viewer applications
| File extension |
Viewer |
| .pdf |
xpdf acroread |
| .ps |
ggv ghostview gs |
| .dvi |
xdvi |
| .jpeg .png |
xview gthumb eog |
Converting between document formats
| from\to |
.tex |
.dvi |
.ps |
.pdf |
.html |
| .tex |
|
latex |
|
pdflatex |
latex2html |
| .dvi |
|
|
dvips |
|
|
| .ps |
|
|
|
ps2pdf |
|
| .pdf |
|
|
pdf2ps |
|
|
| .html |
|
|
|
|
|
Image manipulation from a shell prompt
There are programs for manipulating image files that can be run at a shell
prompt without a need for a graphical interface like the one that the
gimp application uses. These programs are known under the collective
name Netpbm which also stands for a collection of image formats (also
known as npm formats) that can be used as intermediary formats for
converting bettwen the most popular standard image types (e.g.
.jpeg, .png). These formats have extensions like
.ppm which stands for portable pixmap, .pgm for portable
graymap, and .pbm for portable bitmaps. To learn more about these
commands, check out this
link or visit the manual or info pages for the jpegtopnm
command.