Hitchhiker Guide
Hitchhiker Guide
to
Linux
David Money Harris
Created 17 January 2011
Revised 1 January, 2015
The VLSI design tools at Harvey Mudd College are hosted on a Linux server named tera.
This document introduces you to connecting with the server, getting around Linux, and
starting the tools.
Connecting to tera
The usual way to connect to tera is from your Windows, Mac, or Linux-based computer using
the X11 display protocol. From Windows, you will need a program such as Cygwin or PuTTy
with Xming, to open an X terminal. Cygwin is installed on the ECF computers and you can
download it for free onto your personal computer using the directions on X11 for Windows.
Cygwin is heavy install so PuTTy is much lighter alternative.
If you have a Mac or Linux, the X Windows software is already built in.
If you are on Windows, choose Start Programs Cygwin-X XWin Server or you can open a
Cygwin terminal, type xlaunch & and accept all the settings. If you are on Mac, run
/Applications/Utilities/X11.app. If you are on Linux, open a new terminal.
IMPORTANT: If you are using Cygwin-X on an Engineering department lab computer,
be sure to exit Cygwin when you are done. Simply logging out and closing the window
doesnt suffice. Instead, you must right-click on the X icon in the Windows taskbar
notification area (in the lower right corner of the screen) and choose Exit
Unfortunately, if you dont exit properly, youll leave a lock file that will prevent others
from using Cygwin on that computer until it is rebooted. If rebooting doesnt fix the
problem, please notify the Engineering Systems Administrator.
IMPORTANT: If you are using Cygwin for the first time on your personal computer or
on a lab computer, it may be necessary to follow the directions in the additional help
section X11 for Windows.
At the terminal, type ssh Y [email protected], where you supply your
username (usually first initial and last name, such as bkeller for Ben Keller). Tera will prompt
you for your password.
The first time you log in, youll be prompted for your year. A link to your Charlie account will
be automatically set up based on that information. Change your password the first time you log
in, by typing passwd and following the prompt.
You will need some files for the various labs. They are located in /courses/e158/15
to list the contents of your directory. Youll initially see charlie as the only entry. Well
return to this special entry later. To create a new subdirectory, type
mkdir IC_CAD
IC_CAD
To
The GNOME text editor opens up. Type Hello into the text editor, then save and quit. Now,
Typing
ls l
gives you a longer listing showing more information about the files:
drwxr-xr-x 2 bkeller users 4096 Jan 29 2009 charlie
-rw-rw---- 1 bkeller users
6 Jan 17 12:54 foo drwxrxr-x 2 bkeller users 4096 Jan 17 12:44 IC_CAD
The owner is bkeller, who is part of the group users (you should see your user name instead)
The d indicates that both files are directories. It is followed by three triples of letters. The
first wxr means that the user can write, read, and execute the file (for directories, execute
means to enter the directory). The second means that members of the same group can read
and execute but not write the file. The third means that others not in the same group can also
read and execute but not write. The file size is 4096 bytes, which is standard for a directory.
The IC_CAD directory was created on January 17 of this year at 12:44. foo is not a directory
and is only 6 bytes long (five characters plus the carriage return at the end). It is readable and
writable only by bkeller and other group members. In Linux, file names beginning with a dot
are normally not displayed when you type ls. Usually, configuration files are named this way
so they dont clutter things up. To display everything including the dot files, type
ls -al
Some dot files have already been created in your directory. For example, .bash_profile is a
configuration file invoked on log-in that sets up the paths to find various programs.
To print your current working directory, type
pwd
Where .. indicates the directory above where you currently are. (Note that . refers to the
directory where you currently are.) Alternatively, you could have typed
cd /home/bkeller
or
cd /home
cd bkeller
or
cd ~bkeller
where ~bkeller is a shortcut for the home directory of that user (i.e. /home/bkeller)
or just
cd
because cd returns you to your home directory from wherever you are.
To view the contents of a text file, you can open it in an editor such as gedit. However, for
short files, it is often more convenient to use the more command.
more foo
To
Linux supports symbolic links, in which one file is really just a pointer to a second. If you
change the second file, the first will change. For example
ln s fooseball foolink
Then when you ls l, youll see what foolink links to. If you were to use gedit to change
fooseball to say Goodbye, then typed more foolink, youd see Goodbye. Thus, symbolic
links are better than copying when you want two files to remain the same.
To change the permissions on a file, use chmod. Chmod takes three octal numbers, indicating
the permissions for the user, the group, and for others. Each number should be the sum of three
bit fields: 4 for read, 2 for write, and 1 for execute. For example,
chmod 644 fooseball
changes the file to be readable and writable by the user and read-only for everyone else. Then
you could move fooseball into IC_CAD and rename it back to foo
mv fooseball IC_CAD/foo
To get rid of the entire IC_CAD folder and its contents, use the recursive option on rm:
rm r IC_CAD
in the terminal to run gedit in the background. Now, you can use both gedit and the
terminal. To find out what processes you have running, type
ps
TIME CMD
00:00:00 bash
00:00:00 gedit
00:00:00 ps
bash is the Bourne-Again Shell, part of the terminal that interprets the commands you have
been typing. Gedit is running in the background. ps is the command you just invoked. Notice
that each command has a process ID (PID). If a program locks up, you can kill it based on its
PID. For example
kill 29905
kills the gedit session. You would lose any unsaved work, so dont use this unless you have
to.
Instead of putting gedit to sleep and restarting it in the background with separate
commands, you could have typed
gedit &
In the Charlie folder is a README file. To read it and learn about changing your
password, type
more README
Another way to move files between your computer and tera is through an file transport protocol
(FPT) client. WinSCP is a good FPT program for Windows. To get more information about a
command, use man:
man rm