Post on 25-Apr-2020
transcript
Resource Seminar 2007: Introduction to Linux
Eun-seo Choi
Oct 11, 2007
1 Resources
• Senior grads
• System administrators (help@gps.caltech.edu)
• Documents in /home/datalib/Resource Class
• Internet and magazines
– Google, Wikipedia, etc.
– Linux Journal (http://www.linuxjournal.com/), Linux Magazine (http://www.
linux-mag.com/), Linux Format (http://www.linuxformat.co.uk/), and many
others (http://en.wikipedia.org/wiki/List_of_Linux_magazines).
– Source of the up-to-date information.
• http://tldp.org
– The Llinux Documentation Project.
– Guides and FAQs are excellent introductions.
• http://www.ibm.com/developerworks/linux
– Contains a vast collection of toturials on many Linux-related subjects.
– Go to “How do I get started with Linux?” (http://www.ibm.com/developerworks/
linux/newto/#6) to get started with linux.
1
2 Accessing a remote linux server
2.1 SSH
ssh is a remote login program, meaning “secure shell”. ssh and the associated programs
such as scp and sftp are the only allowed methods to remotely access division servers.
There are many different ways of using ssh, but a real basic one is
ssh -X -lusername server or ssh -X username @server
For example,
ssh -X -lces74 narsil.gps.caltech.edu
or
ssh -X ces74@narsil.gps.caltech.edu
where -X option forwards X windows programs (running on the remote host) to a local dis-
play.
For more about ssh, type ‘man ssh’ on a terminal’s command line or visit http://www.
openssh.org/manual.html. There are numerous on-line documents including the 3-part tu-
torial on IBM DeveloperWorks (http://www.ibm.com/developerworks/library/l-keyc.
html).
Several ssh clients for MS Windows are available. Putty is quite popular (http://www.
chiark.greenend.org.uk/~sgtatham/putty/).
2.2 X server on Microsft Windows
You might want to have an “X windows system” available on your MS Windows desktop or
laptop. Then, you can keep working as if you locally logged in a linux server.
Let’s imagine a situation where you are wokring on your MS Windows laptop at home
but want to finish up your Ge161 homework using GMT wihtout going back to the office.
Moreover, you left some partially working scripts in your home directory on the division’s
linux system. You can log in the linux server through the normal terminal emulators and
edit the GMT scripts. However, those terminal programs cannot pop up a window showing
the EPS files you made. To see the results in this particular case or to run other X windows
programs, you need an X server running on your local computer.
You can set up an X windows system on MS Windows using Cygwin (http://www.
cygwin.com/), Xming (http://www.straightrunning.com/XmingNotes/), or X-Win32 (http:
//www.starnet.com/products/xwin32/). The first two are free; the latter is commercial
but is freely downloadable from http://software.caltech.edu.
2
2.3 Virtual machines and dual booting
Instaling a linux system on your computer is an obvious way of getting a linux-compatible
working environment. You have two options for installing linux while keeping your current
non-linux OS. One is to partition your physical hard drive, install linux on one of the parti-
tions, and use “dual booting”. Further information on dual booting is available on wikipedia
(http://en.wikipedia.org/wiki/Dual_boot). The other is to install linux on a “virtual
machine”. If interested, try out one of these: VMWare (commercial, http://www.vmware.
com/), Parallel Workstation (commercial, http://www.parallels.com), Microsoft Virtual
PC (free, http://www.microsoft.com/windowsxp/virtualpc/). Dual booting can be an-
noying because you need to reboot everytime you want to switch to a different OS, while
the virtual machine softwares suffer performance overhead. These techniques might be an
overkill if you just want to work on linux servers.
3 Frequently used programs
For complete documentation of any of the following programs, try man command , or info command
(‘q’ to quit while reading.)
3.1 Overview of file system
Excerpted from Wikipedia’s “Filesystem Hierarchy Standard” (http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard).
[ces74@elendil]/% cd
[ces74@elendil]~% cd /
[ces74@elendil]/% ls
bin/ etc/ lib/ mnt/ proc/ scratch1@ sys/ var/
boot/ export/ lost+found/ net/ root/ selinux/ tmp/
dev/ home/ media/ opt/ sbin/ srv/ usr/
/ Primary hierarchy root and root directory of the entire file system hierarchy.
/bin/ Essential command binaries that need to be available in single user mode; for all
users (e.g., cat, ls, cp).
/boot/ Boot loader files (e.g., kernels, initrd). Often a separate partition.
/dev/ Essential devices (e.g., /dev/null).
3
/etc/ Host-specific system-wide configuration files (the name comes from et cetera).
/etc/opt/ Configuration files for /opt/.
/etc/X11/ Configuration files for the X Window System, version 11.
/etc/sgml/ Configuration files for SGML.
/etc/xml/ Configuration files for XML.
/home/ Users’ home directories - containing saved files, personal settings etc. Often a sep-
arate partition.
/lib/ Libraries essential for the binaries in /bin/ and /sbin/.
/media/ Mount points for removable media such as CD-ROMs (appeared in FHS-2.3).
/mnt/ Temporarily mounted filesystems.
/opt/ Optional application software packages.
/proc/ Virtual filesystem documenting kernel and process status as text files (e.g., uptime,
network).
/root/ Home directory for the root user.
/sbin/ Essential system binaries (e.g., init, route, ifup).
/srv/ Site-specific data which is served by the system.
/tmp/ Temporary files (see also /var/tmp).
/usr/ Secondary hierarchy for user data; contains the majority of (multi-)user utilities and
applications.
/usr/bin/ Non-essential command binaries (not needed in single user mode); for all
users.
/usr/include/ Standard include files.
/usr/lib/ Libraries for the binaries in /usr/bin/ and /usr/sbin/.
/usr/sbin/ Non-essential system binaries (e.g. daemons for various network-services).
/usr/share/ Architecture-independent (shared) data.
/usr/src/ Source code (e.g. the kernel source code with its header files).
4
/usr/X11R6/ X Window System, Version 11 Release 6.
/usr/local/ Tertiary hierarchy for local data, specific to this host. Typically has fur-
ther subfolders, e.g. bin/, lib/, share/.
/var/ Variable files, such as logs, spool files, and temporary e-mail files.
/var/lock/ Lock files. Files keeping track of resources currently in use.
/var/log/ Log files. Various logs.
/var/mail/ Users’ mail-boxes.
/var/run/ Information about the running system since last boot (e.g. currently logged-
in users and running daemons).
/var/spool/ Spool for tasks waiting to be processed (e.g. print queues and unread
mail).
/var/spool/mail/ Deprecated location for users’ mail-boxes.
/var/tmp/ Temporary files to be preserved between reboots.
3.2 Getting system information
uname : Print system information.
df : Report file system disk space usage.
du : Estimate file space usage.
top : Display Linux tasks. While running, hit ’u’ for a user id; ’k’ to kill a process; ’q’ to
quit.
w : Show who is logged on and what they are doing.
finger : User information lookup program.
date : Print or set the system date and time.
time : Time a simple command or give resource usage.
echoi@echoi-laptop:~$ uname -a
Linux echoi-laptop 2.6.20-16-generic #2 SMP Sun Sep 23 19:50:39 UTC 2007 i686 GNU/Linux
5
echoi@echoi-laptop:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 38G 18G 19G 49% /
varrun 1013M 144K 1013M 1% /var/run
varlock 1013M 0 1013M 0% /var/lock
procbususb 1013M 120K 1013M 1% /proc/bus/usb
udev 1013M 120K 1013M 1% /dev
devshm 1013M 0 1013M 0% /dev/shm
lrm 1013M 15M 999M 2% /lib/modules/2.6.20-16-generic/volatile
/dev/sda1 67G 42G 26G 62% /media/sda1
/dev/sda2 5.9G 5.1G 808M 87% /media/sda2
echoi@echoi-laptop:~$ du -sh
13G .
echoi@echoi-laptop:~$ top
top - 17:39:06 up 9:58, 5 users, load average: 0.15, 0.16, 0.14
Tasks: 140 total, 2 running, 137 sleeping, 0 stopped, 1 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 99.2%id, 0.0%wa, 0.0%hi, 0.8%si, 0.0%st
Mem: 2074620k total, 970440k used, 1104180k free, 205656k buffers
Swap: 489972k total, 19428k used, 470544k free, 136692k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3606 echoi 15 0 2320 1184 880 R 1 0.1 0:00.04 top
1 root 15 0 2912 1808 488 S 0 0.1 0:01.79 init
2 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/0
3 root 34 19 0 0 0 S 0 0.0 0:00.00 ksoftirqd/0
4 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/0
8 root 10 -5 0 0 0 S 0 0.0 0:00.73 events/0
10 root 10 -5 0 0 0 S 0 0.0 0:00.00 khelper
11 root 10 -5 0 0 0 S 0 0.0 0:00.00 kthread
35 root 10 -5 0 0 0 S 0 0.0 0:00.00 kblockd/0
37 root 10 -5 0 0 0 S 0 0.0 0:01.44 kacpid
[ces74@narsil]~% w
17:40:08 up 3 days, 1:40, 4 users, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
danb pts/0 rockpile Wed15 25:04m 0.69s 0.69s -tcsh
carltape pts/1 denali Tue08 2days 0.03s 0.03s -bash
6
ces74 pts/2 dhcp-65-221 17:40 0.00s 0.37s 0.00s w
carltape pts/4 denali 06:53 10:45m 0.02s 0.02s -bash
[ces74@narsil]~% finger danb
Login: danb Name: Daniel Bower
Directory: /home/danb Shell: /bin/tcsh
Office: 358 South Mudd
On since Wed Oct 3 15:56 (PDT) on pts/0 from rockpile
1 day 1 hour idle
No mail.
No Plan.
bash-3.1$ date
Sat Oct 6 19:35:42 PDT 2007
bash-3.1$ cat > myprogram
#!/bin/bash
find . -maxdepth 2 -name ’.csh*’
bash-3.1$ chmod +x myprogram
bash-3.1$ time ./myprogram
./.cshrc%
./.cshrc
real 0m1.907s
user 0m0.005s
sys 0m0.022s
3.3 Navigating file system
ls : List directory contents.
cd : Change to another directory.
cd - : Go back to the previous directory.
find : Search for files in a directory hierarchy by file name, modified time, accessed time,
permission, etc.
pwd : Print name of current/working directory.
7
cd : Change to another directory.
which : Locate a command.
echoi@echoi-laptop:~$ ls -tl
합계 232
-rw-r--r-- 1 echoi echoi 7 2007-10-04 17:16 cron.log
drwxr-xr-x 5 echoi echoi 4096 2007-09-30 20:00 Desktop
-rw------- 1 echoi echoi 8155 2007-09-20 15:31 walkthrough_detailed_weak.svg
drwxr-xr-x 3 echoi echoi 4096 2007-08-29 17:21 data
drwxr-xr-x 2 echoi echoi 4096 2007-08-27 14:21 roms
drwxr-xr-x 2 echoi echoi 4096 2007-07-02 23:27 Pictures
drwx------ 2 echoi echoi 4096 2007-06-28 15:50 amsn_received
-rw-r--r-- 1 echoi echoi 87423 2007-06-06 10:06 latest_address.ldif
lrwxrwxrwx 1 echoi echoi 26 2007-04-24 06:01 Examples -> /usr/share/example-content
echoi@echoi-laptop:~$ pwd
/home/echoi
echoi@echoi-laptop:~$ cd opt/stgSnac/Snac/
echoi@echoi-laptop:~/opt/stgSnac/Snac$ ls ~-
echoi@echoi-laptop:~/opt/stgSnac/Snac$ echo ~-
/home/echoi
echoi@echoi-laptop:~/opt/stgSnac/Snac$ echo ~+
/home/echoi/opt/stgSnac/Snac
echoi@echoi-laptop:~/opt/stgSnac/Snac$ cd -
/home/echoi
echoi@echoi-laptop:~$
echoi@echoi-laptop:~/opt$ find ~/opt -name ’deal.II’
/home/echoi/opt/deal.II
/home/echoi/opt/deal.II/deal.II
echoi@echoi-laptop:~/opt$ find . -mmin -60
.
./test.sh
echoi@echoi-laptop:~$ find . -size +1G
./opt/Snac_new/tests/hydroPressure.0
./opt/deal.II.projects/vishunu.tar.bz2
echoi@echoi-laptop:~$ which paraview
8
/home/echoi/opt/paraview-3.0.2-Linux-x86/bin/paraview
3.4 Manipulating files and directories
cp : Copy files or directories.
rm : Remove files or directories.
mv : Rename or move files or directories to another location.
ln -s : Create a symbolic link to an existing file or directory.
mkdir : Make a directory.
rmdir : Remove a directory.
touch : Change file timestamps. Create file if it does not exist yet.
3.5 Acess permission and mode
Every file or folder in Linux has access permissions. There are three types of permissions
(what allowed to do with a file):
• read access
• write access
• execute access
Permissions are defined for three types of users:
• user (owner).
• group that the owner belongs to.
• other user.
A “mode” is one of the possible combinations of permissions and users.
These commands are used to change the mode and the ownership of files and directories.
chmod : Change the mode.
chown : Change the owner.
9
chgrp : Change the group.
ls -l : Print long list including permission.
The following examples are taken from http://www.tldp.org/LDP/intro-linux/html/
sect_03_04.html#sect_03_04_01 .
asim:~> ./hello
bash: ./hello: bad interpreter: Permission denied
asim:~> cat hello
#!/bin/bash
echo "Hello, World"
asim:~> ls -l hello
-rw-rw-r-- 1 asim asim 32 Jan 15 16:29 hello
asim:~> chmod u+x hello
asim:~> ./hello
Hello, World
asim:~> ls -l hello
-rwxrw-r-- 1 asim asim 32 Jan 15 16:29 hello*
asim:~> chmod u+rwx,go-rwx hello
asim:~> ls -l hello
-rwx------ 1 asim asim 32 Jan 15 16:29 hello*
3.6 Viewing and manipulating contents of files
cat : Write each FILE to standard output, first line first.
tac : Write each FILE to standard output, last line first.
less : Displays text one screen at a time. Similar but superior to more. ’q’ to quit.
wc : Print the number of newlines, words, and bytes in files.
paste : Write lines consisting of the sequentially corresponding lines from each file, sepa-
rated by TABs, to standard output.
10
→paste puts together two or more files column by column; cat puts together files one
after another.
cut : Remove sections from each line of files.
head : Output the first part of files.
tail : Output the last part of files.
3.7 Manipulating text files with awk and sed
sed : Strem editor. Read a file line by line, manipulate strings in the line, and print them
to standard output.
awk : Pattern scanning and processing language. It is a programming language.
Examples (from /home/datalib/Resource Class/Resource Class 2005/UNIXtips.txt
by Kevin Lewis):
> ls U*.txt
UNIXtips.txt
> ls U*.txt | sed ’s/txt/doc/g’
UNIXtips.doc
> cat UNIXtips.txt | sed ’s/UNIX/Windows/g’ > Windowstips.txt
> cat UNIXtips.txt | sed ’s/\ //g’ > Unixtips_spacedeleted.txt
> seq -s\ 4
1 2 3 4
> seq -s\ 4 | awk ’{print $1","$2","$3","$4}’
1,2,3,4
> seq -s\ 4 | awk ’{print $1*10","$2/10","cos($3)","$4-7}’
10,0.2,-0.989992,-3
3.8 Managing processes
ps : Report a snapshot of the current processes.
kill : Send a signal to a process (to kill it). Ctrl-c for killing a running process.
nice : Run a program with modified scheduling priority.
11
top : See Section 3.2.
echoi@echoi-laptop:~/opt$ ps
PID TTY TIME CMD
1331 pts/2 00:00:00 bash
2863 pts/2 00:00:00 ps
echoi@echoi-laptop:~/opt$ ps uxwf | grep emacs
echoi 944 0.0 0.4 13808 9632 pts/1 T 16:22 0:00 | | \_ emacs
echoi 957 0.0 0.4 13796 9616 pts/1 T 16:22 0:00 | | \_ emacs
echoi 2867 0.0 0.0 2988 760 pts/2 S+ 17:18 0:00 | | \_ grep emacs
echoi@echoi-laptop:~/opt$ kill -9 957 944
echoi@echoi-laptop:~/opt$ nice -19 myBigProgram
3.9 Printing
Printing in modern linux systems is as easy as, if not easier than, in MS Windows. In case
you still need to send files to printers on command line, use these programs:
lp : Print a file.
lp -d 366sm hp 2side -n 2 file1 Print 2 copies of le1 to 366sm hp 2side.
lpstat : Check the print queue.
lpstat -p 366sm hp 2side Check the queue of 366sm hp 2side
cancel : Cancel a print job.
cancel 366sm hp 2side-36 Cancel job number 36 on 366sm hp 2side.
cancel -u username : Cancel all your jobs on all the printers.
enscript : Convert a text file to a postscript file.
enscript -2 -r file1 Prints file1 with 2 columns and in landscape mode.
enscript -2 -r file1 -o tmp.ps Prints file1 to tmp.ps with 2 columns and in land-
scape mode.
3.10 Archiving and Compression/Uncompression
• Creating an archive file (.tar) from obj/ directory:
tar -cvf obj.tar obj/
12
• Creating an archive file with compression:
tar -czvf obj.tar.gz obj/ compressing with gzip
tar -cjvf obj.tar.bz2 obj/ compressing with bzip2
• Extracting (and uncompressing) an archive file:
tar -xvf obj.tar , tar -xzvf obj.tar.gz , tar -xjvf obj.tar.bz2
• Viewing the contents of an archive file:
tar -tvf obj.tar , tar -tzvf obj.tar.gz , tar -tjvf obj.tar.bz2
4 bash Basics
To learn about bash in a systematic fashion, it is really recommended to read “Bash Ref-
erence Manual” (http://www.gnu.org/software/bash/manual/bashref.html).
The following is a short list of things that are used in the examples of this document
but might look mysterious at first:
. : Current directory. cp test/test.txt .
As a command, equal to source (read and execute).
. .bashrc = source .bashrc
.. : Upper directory by one level. To represent multi-lelvel, ../.., ../../.., etc.
cd .. , mv test.txt ../../../test dir
~ : Equal to /home/username .
cp ~/test.txt ~/test2.txt
; : Commands separated by ; are executed sequentially.
cp ~/test.txt ~/test2.txt; rm /test.txt
& : When put after a command, the process runs in the background.
emacs & = emacs → Ctrl+z → bg
| : When a sequence of commands are separated by ’|’, the standard output of a command
becomes the standard input for the next command.
find ~ -name ’.*’ | grep bash
${} : Variable expansion.
echo ${PATH} , cd ${GMTHOME}
13
‘ ‘ (backquotes) or $() : Command substitution.
echoi@echoi-laptop:~$ ls -l $(which python)
lrwxrwxrwx 1 root root 9 2007-05-31 11:05 /usr/bin/python -> python2.5
echoi@echoi-laptop:~$ ls -l ‘which python‘
lrwxrwxrwx 1 root root 9 2007-05-31 11:05 /usr/bin/python -> python2.5
4.1 Redirection
Redirecting outputs can be useful when you want to save or throw away texts printed on
command line by shell commands or programs.
Texts printed on command line have the type of either stdout or stderr. These are two
of the three standard “file descriptor” (see http://en.wikipedia.org/wiki/File_descriptor).
One of the differences between stdout and stderr is that outputs sent to stdout are “buffered”
before acutally shown while outputs sent to stderr are displayed without delay. Integer
value of 1 and 2 are assigned to stdout and stderr.
The following has been excerpted from “BASH Programming - Introduction HOW-TO”
(http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html).
1. stdout to file
This will cause the ouput of a program to be written to a file. Note that use of ’>’
will overwrite ls-l.txt if it already exists. To append, use ‘>>’.
to create or overwrite, ls -l > ls-l.txt
to append, ls -l >> ls-l.txt
2. stderr to file
This will cause the stderr ouput of a program to be written to a file.
to create or overwrite, grep da * 2> grep-errors.txt
to append, grep da * 2>> grep-errors.txt
3. stdout to stderr
This will cause the stderr ouput of a program to be written to the same filedescriptor
than stdout.
grep da * 1>&2
4. stderr to stdout
This will cause the stderr ouput of a program to be written to the same filedescriptor
14
than stdout.
grep * 2>&1
5. stderr and stdout to file
This will place every output of a program to a file.
rm -f $(find / -name core) &> removedcore.log
This will throw away all the outputs.
rm -f $(find / -name core) &> /dev/null
4.2 Globbing
Globbing is another name for ”filename expansion”. The next examples are from ”Advanced
Bash-Scripting Guide” by Medel Cooper (http://www.faqs.org/docs/abs/HTML/globbingref.
htm).
bash$ ls -l
total 2
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 a.1
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 b.1
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 c.1
-rw-rw-r-- 1 bozo bozo 466 Aug 6 17:48 t2.sh
-rw-rw-r-- 1 bozo bozo 758 Jul 30 09:02 test1.txt
bash$ ls -l t?.sh
-rw-rw-r-- 1 bozo bozo 466 Aug 6 17:48 t2.sh
bash$ ls -l [ab]*
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 a.1
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 b.1
bash$ ls -l [a-c]*
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 a.1
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 b.1
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 c.1
bash$ ls -l [^ab]*
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 c.1
-rw-rw-r-- 1 bozo bozo 466 Aug 6 17:48 t2.sh
-rw-rw-r-- 1 bozo bozo 758 Jul 30 09:02 test1.txt
15
bash$ ls -l {b*,c*,*est*}
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 b.1
-rw-rw-r-- 1 bozo bozo 0 Aug 6 18:42 c.1
-rw-rw-r-- 1 bozo bozo 758 Jul 30 09:02 test1.txt
bash$ echo *
a.1 b.1 c.1 t2.sh test1.txt
bash$ echo t*
t2.sh test1.txt
4.3 Shell programming
Good readings to learn bash programming would be ”Bash guide for beginners” (http://
www.tldp.org/LDP/Bash-Beginners-Guide/html/index.html) and ”Advanced bash-scripting
guide” (http://www.tldp.org/LDP/abs/html/index.html) for more advanced techniques.
The example script given below shows how to use a few important and frequently used
features such as processing command line arguments, using a for loop, and command sub-
stitution. Condition test using if/then is also very useful (see the example in Section 4.5).
To run this script, save the boxed code as rename.sh and run ’chmod u+x rename.sh’.
Then, you can run it like a regular program. An easy way of making a text file on command
line is using cat. For example, ’cat > rename.sh’ → ’copy and paste or type the code’ →’Ctrl-d’.
#!/bin/bash
# rename.sh
# Basic file renamer
criteria=$1
re_match=$2
replace=$3
for i in $( ls *$criteria* );
do
src=$i
tgt=$(echo $i | sed -e "s/$re_match/$replace/")
16
mv $src $tgt
done
4.4 Hierarchy of setup files
/etc/profile
~/.bash_profile
~/.profile
The above files, if exist, are “sourced” (read and executed) in this order when you log in.
They seldom need touching.
/etc/bashrc
~/.bashrc
These files are sourced whenever you run a new (non-login) interactive shell. You do
not have permission to modify the system files in /etc. So, all your personal settings such
as aliases and environment variables should be put in ${HOME}/.bashrc
4.5 Setting up user environment
You can either put everything in a single, ${HOME}/.bashrc, or divide commands into two
(or more) separate files. To take the latter approach, add the code in the box below whatever
is in your current ${HOME}/.bashrc:
if [ -f ~/.envvars ]; then
. ~/.envvars
fi
if [ -f ~/.aliases ]; then
. ~/.aliases
fi
This style is just a suggestion, but I personally find it convenient because setting a per-
sonal environment is usually composed of two things: Defining aliases and setting environ-
ment variables.
17
Now, if you create two files, ${HOME}/.envvars and ${HOME}/.aliases, they will be
sourced everytime you start a new shell. Nothing breaks even if you don’t. In case you al-
ready have many environment-setting commands in the current ${HOME}/.bashrc, you can
simply move all the ’alias ...’ commands to ${HOME}/.aliases and all the ’export ...’ to
${HOME}/.envvars. Be careful to group related commands together. The next section will
clarify what it means.
Setting environment variables
Contents of ${HOME}/.envvars would look like the following:
# GMT
export GMTHOME=/opt/GMT
export PATH=${GMTHOME}/bin:${PATH}
# Matlab
export MATLABDIR=/opt/matlab
export PATH=${MATLABDIR}/bin:${PATH}
# mpich
export CXX=g++
export MPI_DIR=${HOME}/opt/mpich-1.2.7p1
export MPI_BINDIR=${MPI_DIR}/bin
export MPI_INCDIR=${MPI_DIR}/include
export MPI_LIBDIR=${MPI_DIR}/lib
export PATH=${MPI_BINDIR}:${PATH}
export LD_LIBRATY_PATH=${MPI_LIBDIR}:${LD_LIBRATY_PATH}
The environment variables should be “exported” using export, a shell command, so that
all the programs run from the shell can “see” them..
The most important variables are PATH and LD LIBRARY PATH. PATH contains directories
where executables you want to run reside. By maintaining this variable properly, you can
run programs without remembering where they are or typing the whole paths to them ev-
ery time. LD LIBRARY PATH contains directories which a compiler automatically looks into
to find libararies required for building an application. This becomes really important when
you write a big program that depends on codes someone else wrote.
These environment variables have a default values when you log in. For example, PATH
usually include /usr/bin during the login process. That is why you can run commands in
18
/usr/bin like ls, cd, or rm, without adding it to PATH manually. To add new directories
to these variables, you should follow the syntax of export command given in the above
example so as not to overwrite those default values. The same for LD LIBRARY PATH.
Some programs require to export their own set of variables. For example, SAC requires
do the following:
SACAUX = /foo/sac/aux
export SACAUX
So, refer to the program’s documentation when thigns do not work as expected.
Defining aliases
Defining aliases is straight foward. Just follow the syntax in the below example. Note that
“unalias” command is available to temporarily disable an alias.
echoi@echoi-laptop:~$ cat /home/echoi/.aliases
alias ll=’ls -l’
alias la=’ls -A’
alias l=’ls -CF’
alias cp=’cp -i’
alias mv=’mv -i’
alias rm=’rm -i’
alias em=’xemacs’
alias pangu=’\ssh -XA -lces74 pangu.gps.caltech.edu’
alias alfred=’\ssh -XA -lces74 alfred.gps.caltech.edu’
5 Text editors
Whatever your choice is, it is critical for efficient editing to get used to keyboard shorcuts
(see the attached reference cards.)
5.1 vim
Light and fast. Once you get used to its peculiar “mode” concept, any editing job can be
done very efficiently. Best on command line.
19
5.2 Emacs/XEmacs
Powerful in a sense that they are IDE (Integrated Development Environment). In other
words, you can compile, run, and debug programs without going back to a terminal.
5.3 gedit/Kate
Similar to Wordpad of MS Windows, but can do a lot more. Not IDEs, but provide good
support for programming.
6 Other useful applications
Inkscape : SVG (a vector graphics format) editor. Good for drawing cartoons without wor-
rying about resolution. Similar to Adobe Illustrator. Cannot read but can write EPS
files.
ImageMagick, Gimp : Editing images and converting their format.
Thunderbird, KMail, Evolution : Desktop email clients.
OpenOffice : An alternative to MS Office. Can make PDFs of good quality.
LATEX : Can quickly make equation-laden documents with pre-defined formats. Slides and
posters, too.
20
XEm
acsR
eference
Card
(for
versio
n21.0
+)
Startin
gEm
acs
To
enter
XE
macs,
just
type
itsnam
e:xemacs
To
read
ina
file
toed
it,see
Files,
below
.
Leav
ing
Em
acs
susp
end
Em
acs
(or
iconify
fram
eunder
X)
C-z
exit
Em
acs
perm
anen
tlyC-x
C-c
Files
read
afile
into
Em
acs
C-x
C-f
save
afile
back
todisk
C-x
C-s
save
all
files
C-x
sin
sert
conten
tsofanoth
erfile
into
this
buffer
C-x
irep
lace
this
file
with
the
file
you
really
want
C-x
C-v
write
buffer
toa
specifi
edfile
C-x
C-w
Gettin
gH
elp
The
Help
system
issim
ple.
TypeC-h
and
follow
the
directio
ns.
Ifyou
are
afirst-tim
euser,
typeC-h
tfo
ra
tuto
ria
l.
quit
Help
win
dow
qscro
llH
elpw
indow
space
apro
pos:
show
com
mands
match
ing
astrin
gC-h
ash
owth
efu
nctio
na
key
runs
C-h
cdescrib
ea
functio
nC-h
fget
mode-sp
ecific
info
rmatio
nC-h
m
Error
Recovery
abort
partia
llyty
ped
orex
ecutin
gco
mm
and
C-g
recover
afile
lost
by
asy
stemcra
shM-x
recover-file
recover
files
from
aprev
ious
Em
acs
session
M-x
recover-session
undo
an
unw
anted
change
C-x
uorC-_
restore
abuffer
toits
orig
inalco
nten
tsM-x
revert-buffer
redraw
garb
aged
screenC-l
Increm
ental
Search
search
forw
ard
C-s
search
back
ward
C-r
regula
rex
pressio
nsea
rchC-M-s
reverse
regula
rex
pressio
nsea
rchC-M-r
selectprev
ious
search
string
M-p
selectnex
tla
tersea
rchstrin
gM-n
exit
increm
enta
lsea
rchRET
undo
effect
ofla
stch
ara
cterDEL
abort
curren
tsea
rchC-g
Use
C-s
orC-r
again
torep
eat
the
search
ineith
erdirectio
n.
IfE
macs
isstill
search
ing,C-g
cancels
only
the
part
not
done.
c©1998
Fre
eSoftw
are
Foundatio
n,In
c.
Perm
issions
on
back.
v2.0
XEm
acs
Motion
entity
tom
ove
over
backw
ard
forw
ard
chara
cterC-b
C-f
word
M-b
M-f
line
C-p
C-n
go
tolin
ebeg
innin
g(o
ren
d)
C-a
C-e
senten
ceM-a
M-e
para
gra
ph
M-{
M-}
page
C-x
[C-x
]sex
pC-M-b
C-M-f
functio
nC-M-a
C-M-e
go
tobuffer
beg
innin
g(o
ren
d)
M-<
M->
scroll
tonex
tscreen
C-v
scroll
toprev
ious
screenM-v
scroll
leftC-x
<scro
llrig
ht
C-x
>scro
llcu
rrent
line
tocen
terofscreen
C-u
C-l
Killin
gan
dD
eleting
entity
tokill
backw
ard
forw
ard
chara
cter(d
elete,not
kill)
DEL
C-d
word
M-DEL
M-d
line
(toen
dof)
M-0
C-k
C-k
senten
ceC-x
DEL
M-k
sexp
M--
C-M-k
C-M-k
kill
regio
nC-w
copy
regio
nto
kill
ring
M-w
kill
thro
ugh
nex
toccu
rrence
ofch
ar
M-z
char
yank
back
last
thin
gkilled
C-y
repla
cela
styank
with
prev
ious
kill
M-y
Mark
ing
setm
ark
here
C-@
orC-SPC
exch
ange
poin
tand
mark
C-x
C-x
setm
ark
arg
words
away
M-@
mark
paragraph
M-h
mark
page
C-x
C-p
mark
sexp
C-M-@
mark
functio
nC-M-h
mark
entire
buffer
C-x
h
Query
Rep
lace
intera
ctively
repla
cea
text
string
M-%
usin
greg
ula
rex
pressio
ns
M-x
query-replace-regexp
Valid
responses
inquery
-repla
cem
ode
are
repla
ce
this
one,
go
on
tonex
tSPC
ory
repla
ceth
isone,
don’t
mov
e,
skip
tonex
tw
ithout
repla
cing
DEL
orn
repla
ceall
remain
ing
match
es!
back
up
toth
eprev
ious
match
^exit
query
-repla
ceESC
enter
recursiv
eed
it(C-M-c
toex
it)C-r
delete
match
and
enter
recursiv
eed
itC-w
Multip
leW
indow
sdelete
all
oth
erw
indow
sC-x
1delete
this
win
dow
C-x
0sp
litw
indow
intw
overtica
llyC-x
2sp
litw
indow
intw
ohorizo
nta
llyC-x
3
scroll
oth
erw
indow
C-M-v
switch
curso
rto
anoth
erw
indow
C-x
o
shrin
kw
indow
shorter
M-x
shrink-window
grow
win
dow
taller
C-x
^sh
rink
win
dow
narrow
erC-x
{grow
win
dow
wid
erC-x
}
selectbuffer
inoth
erw
indow
C-x
4b
disp
laybuffer
inoth
erw
indow
C-x
4C-o
find
file
inoth
erw
indow
C-x
4f
find
file
read-o
nly
inoth
erw
indow
C-x
4r
run
Dired
inoth
erw
indow
C-x
4d
find
tag
inoth
erw
indow
C-x
4.
Form
atting
inden
tcu
rrentlin
e(m
ode-d
epen
den
t)TAB
inden
tregio
n(m
ode-d
epen
den
t)C-M-\
inden
tse
xp
(mode-d
epen
den
t)C-M-q
inden
treg
ion
rigid
lyarg
colu
mns
C-x
TAB
insert
new
line
after
poin
tC-o
mov
erest
oflin
evertica
llydow
nC-M-o
delete
bla
nk
lines
aro
und
poin
tC-x
C-o
join
line
with
prev
ious
(with
arg
,nex
t)M-^
delete
all
white
space
aro
und
poin
tM-\
put
exactly
one
space
at
poin
tM-SPC
fill
para
gra
ph
M-q
setfill
colu
mn
C-x
fset
prefi
xea
chlin
esta
rtsw
ithC-x
.
Case
Chan
geupperca
sew
ord
M-u
lowerca
sew
ord
M-l
capita
lizew
ord
M-c
upperca
sereg
ion
C-x
C-u
lowerca
sereg
ion
C-x
C-l
capita
lizereg
ion
M-x
capitalize-region
The
Min
ibuffer
The
follow
ing
key
sare
defi
ned
inth
em
inib
uffer.
com
plete
as
much
as
possib
leTAB
com
plete
up
toone
word
SPC
com
plete
and
execu
teRET
show
possib
leco
mpletio
ns
?fetch
prev
ious
min
ibuffer
input
M-p
fetchnex
tla
term
inib
uffer
input
M-n
regex
psea
rchback
ward
thro
ugh
histo
ryM-r
regex
psea
rchfo
rward
thro
ugh
histo
ryM-s
abort
com
mand
C-g
TypeC-x
ESC
ESC
toed
itand
repea
tth
ela
stco
mm
and
that
used
the
min
ibuffer.
The
follow
ing
key
sare
then
defi
ned
.
prev
ious
min
ibuffer
com
mand
M-p
nex
tm
inib
uffer
com
mand
M-n
12
3
XEm
acsR
eference
Card
Buffers
selectanoth
erbuffer
C-x
blist
all
buffers
C-x
C-b
kill
abuffer
C-x
k
Tran
sposin
g
transp
ose
characte
rs
C-t
transp
ose
words
M-t
transp
ose
lines
C-x
C-t
transp
ose
sexps
C-M-t
Spellin
gC
heck
check
spellin
gofcu
rrent
word
M-$
check
spellin
gofall
word
sin
regio
nM-x
ispell-region
check
spellin
gofen
tirebuffer
M-x
ispell-buffer
Tags
find
ata
g(a
defi
nitio
n)
M-.
find
nex
toccu
rrence
ofta
gC-u
M-.
specify
anew
tags
file
M-x
visit-tags-table
regex
psea
rchon
all
files
inta
gs
table
M-x
tags-search
run
query
-repla
ceon
all
the
files
M-x
tags-query-replace
contin
ue
last
tags
search
or
query
-repla
ceM-,
Shells
execu
tea
shell
com
mand
M-!
run
ash
ellco
mm
and
on
the
regio
nM-|
filter
regio
nth
rough
ash
ellco
mm
and
C-u
M-|
start
ash
ellin
win
dow
*shell*
M-x
shell
Rectan
gles
copy
rectangle
toreg
isterC-x
rr
kill
rectangle
C-x
rk
yank
rectangle
C-x
ry
open
rectangle,
shiftin
gtex
trig
ht
C-x
ro
bla
nk
out
rectangle
M-x
clear-rectangle
prefi
xea
chlin
ew
itha
string
M-x
string-rectangle
selectrecta
ngle
with
mouse
M-button1
Abbrev
s
add
glo
balabbrev
C-x
ag
add
mode-lo
calabbrev
C-x
al
add
glo
balex
pansio
nfo
rth
isabbrev
C-x
aig
add
mode-lo
calex
pansio
nfo
rth
isabbrev
C-x
ail
explicitly
expand
abbrev
C-x
ae
expand
prev
ious
word
dynam
ically
M-/
Regu
larExpression
s
any
single
chara
cterex
cept
anew
line
.(d
ot)
zeroor
more
repea
ts*
one
or
more
repea
ts+
zeroor
one
repea
t?
any
chara
cterin
the
set[
...]
any
chara
cternot
inth
eset
[^
...]
beg
innin
goflin
e^
end
oflin
e$
quote
asp
ecialch
ara
cterc
\c
altern
ativ
e(“
or”
)\|
gro
upin
g\(
...\)
nth
gro
up
\n
beg
innin
gofbuffer
\‘
end
ofbuffer
\’
word
brea
k\b
not
beg
innin
gor
end
ofw
ord
\B
beg
innin
gofw
ord
\<
end
ofw
ord
\>
any
word
-synta
xch
ara
cter\w
any
non-w
ord
-synta
xch
ara
cter\W
chara
cterw
ithsy
nta
xc
\sc
chara
cterw
ithsy
nta
xnot
c\Sc
Registers
save
regio
nin
register
C-x
rs
insert
register
conten
tsin
tobuffer
C-x
ri
save
valu
eofpoin
tin
register
C-x
rSPC
jum
pto
poin
tsav
edin
register
C-x
rj
Info
enter
the
Info
docu
men
tatio
nrea
der
C-h
i
Mov
ing
with
ina
node:
scroll
forw
ard
SPC
scroll
reverse
DEL
beg
innin
gofnode
.(d
ot)
Mov
ing
betw
eennodes:
next
node
nprevio
us
node
pm
ove
up
uselect
men
uitem
by
nam
em
selectnth
men
uitem
by
num
ber
(1–5)
nfo
llowcro
ssreferen
ce(retu
rnw
ithl)
fretu
rnto
last
node
you
sawl
return
todirecto
rynode
dgo
toany
node
by
nam
eg
Oth
er:
run
Info
tuto
ria
lh
listIn
foco
mm
ands
?quit
Info
qsea
rchnodes
for
regex
ps
Key
board
Macros
start
defi
nin
ga
key
board
macro
C-x
(end
key
board
macro
defi
nitio
nC-x
)execute
last-d
efined
key
board
macro
C-x
eedit
key
board
macro
C-x
C-k
appen
dto
last
key
board
macro
C-u
C-x
(nam
ela
stkey
board
macro
M-x
name-last-kbd-macro
insert
Lisp
defi
nitio
nin
buffer
M-x
insert-kbd-macro
Com
man
ds
Dealin
gw
ithEm
acsLisp
evalse
xp
befo
repoin
tC-x
C-e
evalcu
rrentdefu
nC-M-x
evalregio
nM-x
eval-region
evalen
tirebuffer
M-x
eval-current-buffer
read
and
evalm
inib
uffer
M-ESC
re-execu
tela
stm
inib
uffer
com
mand
C-x
ESC
ESC
read
and
evalE
macs
Lisp
file
M-x
load-file
load
from
standard
system
directo
ryM-x
load-library
Sim
ple
Custom
ization
Here
are
som
eex
am
ples
ofbin
din
gglo
balkey
sin
Em
acs
Lisp
.
(global-set-key
[(control
c)
g]
’goto-line)
(global-set-key
[(control
x)
(control
k)]
’kill-region)
(global-set-key
[(meta
#)]
’query-replace-regexp)
An
exam
ple
ofsettin
ga
varia
ble
inE
macs
Lisp
:
(setq
backup-by-copying-when-linked
t)
Writin
gC
omm
ands
(defun
com
mand-n
am
e(args
)"docu
men
tatio
n"
(interactive
"tem
pla
te")
body)
An
exam
ple:
(defun
this-line-to-top-of-window
(line)
"Reposition
line
point
is
on
to
top
of
window.
With
ARG,
put
point
on
line
ARG.
Negative
counts
from
bottom."
(interactive
"P")
(recenter
(if
(null
line)
0(prefix-numeric-value
line))))
The
arg
um
ent
tointeractive
isa
string
specify
ing
how
toget
the
arg
um
ents
when
the
functio
nis
called
intera
ctively.
Type
C-h
finteractive
for
more
info
rmatio
n.
Copyrig
ht
c©1998
Fre
eSoftw
are
Foundatio
n,In
c.
desig
ned
by
Ste
phen
Gild
ea,A
pril
1998
v2.0
XEm
acs
for
GN
UEm
acs
versio
n19
on
Unix
syste
ms
Update
dfo
rX
Em
acs
inFebru
ary
1995
by
Ben
Win
g
Perm
ission
isgra
nte
dto
make
and
distrib
ute
copie
sof
this
card
pro
-vid
ed
the
copyrig
ht
notic
eand
this
perm
ission
notic
eare
pre
serv
ed
on
all
copie
s.
For
copie
softh
eG
NU
Em
acs
manual,
write
toth
eFre
eSoftw
are
Foun-
datio
n,In
c.,
59
Tem
ple
Pla
ce
-Suite
330,B
osto
n,M
A02111-1
307,U
SA
.
45
6
ViR
eference
Card
Mod
es
Vi
has
two
mod
es:in
sertion
mod
e,an
dco
mm
an
dm
od
e.T
he
edito
rb
egin
sin
com
man
dm
od
e,w
here
curso
rm
ove-
men
tan
dtex
td
eletion
an
dp
astin
goccu
r.In
sertion
mod
eb
egin
su
pon
enterin
gan
insertio
nor
chan
ge
com
man
d.
[ES
C]retu
rns
the
edito
rto
com
man
dm
od
e(w
here
you
can
qu
it,fo
rex
am
ple
by
typ
ing:q!).
Most
com
man
ds
execu
teas
soon
as
you
typ
eth
emex
cept
for
“co
lon
”co
mm
an
ds
wh
ichex
ecute
wh
enyou
press
the
return
key.
Qu
itting
exit,
savin
gch
an
ges
:x
qu
it(u
nless
chan
ges)
:q
qu
it(fo
rce,ev
enif
un
saved
):q!
Inse
rting
text
insert
befo
recu
rsor,
befo
relin
ei,I
ap
pen
dafter
curso
r,after
line
a,A
op
enn
ewlin
eafter,
line
befo
reo,O
repla
ceon
ech
ar,
many
chars
r,R
Motio
nleft,
dow
n,
up
,rig
ht
h,j,k,l
nex
tw
ord
,b
lan
kd
elimited
word
w,W
beg
inn
ing
of
word
,of
bla
nk
delim
itedw
ord
b,B
end
of
word
,of
bla
nk
delim
itedw
ord
e,E
senten
ceb
ack
,fo
rward
(,)
para
gra
ph
back
,fo
rward
{,}
beg
inn
ing,
end
of
line
0,$
beg
inn
ing,
end
of
file
1G,G
linen
nG
or:n
forw
ard
,b
ack
toch
arc
fc
,Fc
top
,m
idd
le,b
otto
mof
screenH,M,L
Dele
ting
text
Alm
ost
all
deletio
nco
mm
an
ds
are
perfo
rmed
by
typ
ingd
follow
edby
am
otio
n.
For
exam
ple
dw
deletes
aw
ord
.A
fewoth
erd
eletion
sare:
chara
cterto
right,
leftx,X
toen
dof
line
Dlin
edd
line
:d
Yan
kin
gte
xt
Lik
ed
eletion
,alm
ost
all
yan
kco
mm
an
ds
are
perfo
rmed
by
typ
ingy
follow
edby
am
otio
n.
For
exam
ple
y$
yan
ks
toth
een
dof
line.
Tw
ooth
eryan
kco
mm
an
ds
are:
line
yy
line
:y
Ch
an
gin
gte
xt
Th
ech
an
ge
com
man
dis
ad
eletion
com
man
dth
at
leaves
the
edito
rin
insert
mod
e.It
isp
erform
edby
typ
ingc
fol-
lowed
by
am
otio
n.
For
exam
plecw
chan
ges
aw
ord
.A
fewoth
erch
an
ge
com
man
ds
are:
toen
dof
line
Clin
ecc
Pu
tting
text
pu
tafter
positio
nor
after
line
pp
ut
befo
rep
ositio
nor
befo
relin
eP
Bu
ffers
Nam
edb
uff
ersm
ayb
esp
ecified
befo
reany
deletio
n,
chan
ge,
yan
k,
or
pu
tco
mm
an
d.
Th
egen
eral
prefi
xh
as
the
form
"c
wh
erec
may
be
any
lower
case
letter.F
or
exam
ple,
"adw
deletes
aw
ord
into
bu
ffer
a.
Itm
ayth
ere-after
be
pu
tb
ack
into
the
text
with
an
ap
pro
pria
tep
ut
com
man
d,
for
exam
ple
"ap.
Mark
ers
Nam
edm
ark
ersm
ayb
eset
on
any
line
of
afi
le.A
ny
lower
case
letterm
ayb
ea
mark
ern
am
e.M
ark
ersm
ayalso
be
used
as
the
limits
for
ran
ges.
setm
ark
erc
on
this
line
mc
goto
mark
erc
‘c
goto
mark
erc
first
non
-bla
nk
’c
Search
for
Strin
gs
search
forw
ard
/string
search
back
ward
?string
repea
tsea
rchin
sam
e,rev
ersed
irection
n,N
Rep
lace
Th
esea
rchan
drep
lace
fun
ction
isacco
mp
lished
with
the
:s
com
man
d.
Itis
com
mon
lyu
sedin
com
bin
atio
nw
ithra
nges
or
the:g
com
man
d(b
elow).
repla
cep
attern
with
string
:s/pattern/string/flags
flags:
all
on
each
line,
con
firm
each
g,c
repea
tla
st:s
com
man
d&
Regu
lar
Exp
ressio
ns
any
single
chara
cterex
cept
new
line
.(d
ot)
zeroor
more
repea
ts*
any
chara
cterin
set[...]
any
chara
ctern
ot
inset
[^...]
beg
inn
ing,
end
of
line
^,$
beg
inn
ing,
end
of
word
\<
,\
>gro
up
ing
\(...\
)co
nten
tsofn
thgro
up
ing
\n
Cou
nts
Nea
rlyev
eryco
mm
an
dm
ayb
ep
receded
by
anu
mb
erth
at
specifi
esh
owm
any
times
itis
tob
ep
erform
ed.
For
exam
-p
le5dw
will
delete
5w
ord
san
d3fe
will
mov
eth
ecu
rsor
forw
ard
toth
e3rd
occu
ran
ceof
the
lettere.
Even
inser-
tion
sm
ayb
erep
eated
conven
iently
with
this
meth
od
,say
toin
sertth
esa
me
line
100
times.
Ran
ges
Ran
ges
may
preced
em
ost
“co
lon
”co
mm
an
ds
an
dca
use
them
tob
eex
ecuted
on
alin
eor
lines.
For
exam
ple
:3,7d
wou
ldd
eletelin
es3−
7.
Ran
ges
are
com
mon
lyco
mb
ined
with
the:s
com
man
dto
perfo
rma
repla
cemen
ton
severa
llin
es,as
with
:.,$s/pattern/string/g
tom
ake
arep
lace-
men
tfro
mth
ecu
rrent
line
toth
een
dof
the
file.
lines
n-m
:n,m
curren
tlin
e:.
last
line
:$
mark
erc
:’c
all
lines
:%
all
match
ing
lines
:g/pattern/
File
sw
ritefi
le(cu
rrent
file
ifn
on
am
egiv
en)
:wfile
read
file
after
line
:rfile
nex
tfi
le:n
prev
iou
sfi
le:p
edit
file
:efile
repla
celin
ew
ithp
rogra
mou
tpu
t!!program
Oth
er
toggle
up
per/
lower
case
~jo
inlin
esJ
repea
tla
sttex
t-chan
gin
gco
mm
an
d.
un
do
last
chan
ge,
all
chan
ges
on
line
u,U