An Introduction to Linux for Windows Users: An Introduction to Linux for Windows Users
Booth Engineering Center for Advanced Technology (BECAT) Seminar Outline: Outline System Overview
Accessing the System
The File System and File Access Rights
Summary of Useful Commands/Utilities
X-Window System and Cygwin/X
Acknowledgment Equipment: Equipment SGI Altix 3700 BX2 System (sgi1)
64 Intel Itanium 2 Processors (1.5GHz/4MB)
64 GB RAM
SGI Altxi 350 Server (sgi2)
8 Intel Itanium 2 Processors (1.5GHz/6MB)
8 GB RAM
SuSE SLES 9/SGI ProPack 4 Software : Software GNU Compilers, Intel C++/Fortran Compilers
Libraries : BLAS, LAPACK, SCSL, MKL, MPT, OpenMP etc.
Applications: Scilab, Octave, VTK, Paraview, R, etc. Accessing the System: Accessing the System OpenSSH
SSH Client – Putty
SFTP Client – WinSCP
Other SSH Clients
http://www.ssh.com Accessing the System - Putty: Accessing the System - Putty Accessing the System - Putty: Accessing the System - Putty Accessing the System - Putty: Accessing the System - Putty Accessing the System - Putty: Accessing the System - Putty FAQs : FAQs Where is my home directory?
What is the disk quota limit?
500 MB for the home directory
Up to 500 GB for /data/scratch
How do I navigate the file system?
FAQs: FAQs How do I create directories/files?
nedit, pico, vi, emacs
How do I delete directories/files?
rm –rf dir/files
How do I protect my directories/files from being viewd by other users?
chmod 700 dir/file
FAQs: FAQs Are my files backed up automatically?
For the time being, no.
How do I back up my files?
Use tar, gzip and transfer backup files to a safe place
How do I transfer files between sgi1 and my PC?
How do I access the system from home?
Through fester or VPN Transferring Files - WinSCP: Transferring Files - WinSCP Transferring Files - WinSCP: Transferring Files - WinSCP Passwords: Passwords Every account must have a password.
Passwords can be composed of letters, numbers, the space character and other special symbols. It is essential for users to choose a strong password.
Passwords are case-sensitive. Changing Your Password: Changing Your Password Standalone systems: passwd
The SoE systems:
Method 1: USING SOE WEB MAIL
Go to www.engr.uconn.edu/mail
Enter your SOE email ID, hit Enter
Click on Read Mail
Enter ID and Pass Word
Click on the Options Icon located in the bottom left
Scroll down to Change Password
Enter Account, Old Password, New Password and Confirm new password
Method 2: USING ECS LC
Come to any ECS LC and login into any PC,
then press CTRL, ALT & DEL again while logged in.
You will be able to select Change Password from the Task Menu. The Shell : The Shell Shell – command processor
Korn shell (/bin/ksh)
C shell (/bin/csh)
Bourne Shell (/bin/sh)
Bourne Again Shell (/bin/bash)
Switch between shells BASH: BASH Bash is a command language interpreter
Bash is the most popular shell under Linux
The prompt: %, #, $, ~>
Everything you type before return is consider to be the command line
The first word is taken to be the command
Everything else on the command line is information for either the command itself or for the shell. Options usually begin with a minus sign BASH: Startup Environment: BASH: Startup Environment When a login shell starts, BASH reads and executes commands from:
When an interactive shell (not login shell) starts, BASH reads and executes commands from:
BASH: Startup Script Example: BASH: Startup Script Example # Sample .bashrc
test -s ~/.alias && . ~/.alias BASH: BASH Some useful shell commands:
ls – lists the files you have in the current directory
date – gives the date and time
who – gives information about who is currently logged on
man – access to the on-line manual when you need to check the syntax of a command BASH : BASH cat - concatenates files together and sends the result to stdout
more - gives you one screenful of the files at a time. Type the SPACE bar to get another screenful.
find - search for files in a directory hierarchy BASH: BASH Controlling the flow of input and output
To redirect input to come from a specified file (instead of stdin), type:
command < filename
To redirect output to a specified file (instead of stdout), type:
command > filename
Example : $ ls –lct > list.txt BASH : BASH Piping – connecting stdout of one command to stdin of another
One can pipe the output of one command into the input of another command by using the vertical bar character (|).
$ cat file1 file2 | more
Concatenate the files file1 and file2 and use the results as input to the more program Processes: Processes A process is a shell command or a program in execution.
When you log in, a process is created. This process is executing the shell
When you execute a shell command, a new process is created. When the command terminates, the new process dies.
A single user can have many processes executing at the same time Processes: Processes The command ps is used to determine the status of active processes. The command returns the process id (PID) number and other information such as the amount of CPU time the process has used (TIME) and the command which invoked the process (CMD).
Options may be combined.
UNIX options; BSD options; GNU options Examples of the ps Command : Examples of the ps Command hpc@linuxAltix:~> ps
PID TTY TIME CMD
7032 pts/11 00:00:00 bash
7346 pts/11 00:00:00 ps
hpc@linuxAltix:~> ps -ef|more
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Jan22 ? 00:00:14 init 
root 2 1 0 Jan22 ? 00:00:00 [migration/0]
root 3 1 0 Jan22 ? 00:00:00 [ksoftirqd/0]
root 4 1 0 Jan22 ? 00:00:00 [migration/1]
root 5 1 0 Jan22 ? 00:00:00 [ksoftirqd/1]
root 6 1 0 Jan22 ? 00:00:02 [migration/2]
root 7 1 0 Jan22 ? 00:00:00 [ksoftirqd/2]
root 8 1 0 Jan22 ? 00:00:00 [migration/3]
root 9 1 0 Jan22 ? 00:00:00 [ksoftirqd/3]
root 10 1 0 Jan22 ? 00:00:00 [migration/4]
root 11 1 0 Jan22 ? 00:00:00 [ksoftirqd/4]
root 12 1 0 Jan22 ? 00:00:00 [migration/5] Top: Top The command top is used to show a real-time view of Linux tasks
top can be used to display the CPU/memory usage of each task and the CPU the task is running on in a SMP system
$ top -u Top: Top Top: Options: Top: Options Top: Top Terminate Processes: Terminate Processes kill is used to terminate processes or to send signal to processes.
$ kill PID
Terminate the process with the process id (PID).
$ kill –HUP PID
Restart the process with the process id (PID).
$ kill -9 -1
Terminate all processes. Useful when you want to clean all the tasks you initiated.
The File System: The File System Ext2, ext3, reiserfs, xfs and more
Journaling file system is a file system which records changes to a journal before writing to the main system, e. g. ext3, reiserfs etc.
The File System: The File System UNIX file name can be very long.
Use alphabetic, numeric and some special characters.
Files started with a .(dot) are hidden. Use
$ ls –a
to display hidden files.
Hierarchical file structure (tree structure). The File System: The File System You are automatically placed in your home directory after logging in.
e.g. /u/home/hpc, /home/hpc
You can move up and down in the tree to other directories if you have permission to do so. The File System: The File System Commands for moving around in the directory structure
pwd – no argument needed. Tells you the current directory/path
cd dir_name – this changes your position to the specific directory
You can specify directory names in two ways:
The full pathname from the root of the tree
$ cd /u/home/hpc/test/bin
A pathname relative to you current directory
$ cd .
$ cd ..
$cd test/bin The File System: The File System Creating new directories and removing old ones
$ mkdir dir_name
This command creates a new directory.
$ rmdir dir_name
This command is used to delete the directory, which must be empty.
$ rm –rf dir_name
This command is used to delete the directory and all the files in it. The File System: Pathnames: The File System: Pathnames The root of the tree is specified by the character /
All levels of a subtree are separated by the character /
Examples of complete pathnames are:
Examples of relative pathnames are:
ee401/homework The File System – ls -l: The File System – ls -l File Access Rights: File Access Rights The command ls -l displays the access right to a file.
The first single character specifies whether the entry is a directory (d), a simple file (-) or a link (l).
r : read permission
w : write/modify permission
x : execute permission for a file or search permission for a directory
- : no permission File Access Rights: File Access Rights Example: drwxr_xr_x
The first group (rwx) specifies the access privileges of the owner of the file or directory
The next group (r_x) specifies the access privileges of a group in which the owner is a member
The last group (r_x) specifies the access privileges of the rest of the world (i.e. everyone on the system) Changing the Access Rights: chmod: Changing the Access Rights: chmod The command changes the access rights to a file or directory.
There are two ways to do this:
2. using octal notation Changing the Access Rights: Symbolically: Changing the Access Rights: Symbolically $ chmod [who]permission filename
who is specified by u (user/owner), g (group), o (others), a (all three)
Add execute permission to the owner of the file file1:
$ chmod u+x file1
Remove execute permission from everyone including the owner on the file file2:
$ chmod a-x file2
Changing the Access Rights: Using OCTAL notation: Changing the Access Rights: Using OCTAL notation $ chmod mode filename
The mode is specified by treating each of the groups of three rwx fields as an octal digit.
Read permission has a value of 4
Write permission has a value of 2
Execute permission has a value of 1
$ chmod 700 file1
changes access rights of file1 to -rwx------
$ chmod 644 dir2
changes access rights of dir2 to drw-r--r--
File Archiving: tar: File Archiving: tar Saves and restores multiple files to/from a single file. Directories followed recursively.
tar [opitions] [options_values] [files]
$ tar cvf /tmp/backup.tar ~/data ~/test
$ tar xvf backup.tar File Compression: gzip: File Compression: gzip Compressing files: gzip filename
$ gzip backup.tar
The resulted file is backup.tar.gz
Uncompressing files: gzip –d filename.gz
$ gzip –d backup.tar.gz
The uncompressed file is backup.tar
GUN Tar combines uncompress and untar
$ tar zxvf filename.tar.gz Example: Back Up: Example: Back Up Files can be drag and drop to your PC using WinSCP.
To back up all the files in a directory:
Create a directory to hold the backup file
Use tar to save files into a single tar file
Compress the tarball using gzip
Transfer the compressed backup file (filename.tar,gz) to your PC
Delete the backup file or folder on the server
The backup file can be expanded on PC using WinZip and other utilities
Relative path and full path Example: Back Up: Example: Back Up Editors: Editors vi - a universal text editor in UNIX/Linux
$ vi filename
nano – a free pico clone in the style of the Pine composer
$ nano filename
emacs – an extensible, customizable, self-documenting real-time display editor
nedit - a multi-purpose text editor for the X Window System
Editors - nano: Editors - nano Editors - nedit: Editors - nedit Summary of Useful Commands/Utilities : Summary of Useful Commands/Utilities man [command] – display the manual page for the command
ls –al | more – list all the files in the current directory
cd [dir] – change the current directory
cd .. – go to the parent directory
pwd - print the current directory
rm [file] – delete a file
rm –rf [file,dir] – force delete files or directories Summary of Useful Commands/Utilities: Summary of Useful Commands/Utilities cp [file1] [file2] – copy file1 to file2, the paths need to be added if the files are not in the current directory
mv [oldname] [newname] – rename the file or directory
mkdir [dir] – create a directory
du –ks – print the space used by the current directory
quota –v – display the disk usage by the current users
Summary of Useful Commands/Utilities: Summary of Useful Commands/Utilities find [dir] –name [filename] – search files with the filename under the directory
chmod 700 [file] – change the permission of the file so only the owner can read, write and execute the file
chmod –R mode [dir] – change the permissions recusively
tar – archive files
gzip – compress and expand file(s)
export – display the current environment Summary of Useful Commands/Utilities: Summary of Useful Commands/Utilities ps –ef | more – display all the processes
top – show real-time view of tasks
top –u [username] – show tasks owned by the user
kill [pid] – terminate the process
kill -9 -1 – terminate all the processes owned by you
Summary of Useful Commands/Utilities: Summary of Useful Commands/Utilities who – displays who is logged on
which [command] – shows the full path of the command
Examples: Compiling and Running Simple Programs: Examples: Compiling and Running Simple Programs $ g77 hello.f
$ icc –o foobar foobar.c -lmkl_lapack -lmkl_ipf -lguide -lpthread
$ icc –o hello hello.c –lmpi
$ mpirun –np 4 hello X and Cygwin/X: X and Cygwin/X X Window System (X11 or X) presents the toolkit and protocol to build GUI on Unix, Unix-like systems.
To display the remote X GUI applications on your local PC, an X server program (Hummingbird Exceed, XWin32, Cygwin/X etc.) needs to be running on the PC.
Cygwin/X provides X Window System for Microsoft Windows.
X11 Forwarding/Tunneling through SSH
Another seminar will be offered regarding Cygwin/X More Information: More Information For supercomputer issues (sgi1, sgi2)
For SoE Email/UNIX accounts, VPN
ECS Help Desk
Acknowledgement: Acknowledgement Some materials in this presentation are based on seminar notes prepared by Sue Lipsky and other Booth Research Center technical staff
Jerry Peek et al, UNIX Power Tools, 2nd, O’Reilly, 1997