Digital VLSI Design
Introduction to Unix
History of UNIX
• First Version was created in Bell Labs in 1969.
• Some of the Bell Labs programmers who had worked on this project, Ken Thompson, Dennis Ritchie, Rudd Canaday,
and Doug McIlroy designed and implemented the first version of the Unix File System along with a few utilities. It was
given the name UNIX by Brian Kernighan.
• 00:00:00 Hours, Jan 1, 1970 is time zero for UNIX. It is also called as epoch.
• 1973 Unix is re-written mostly in C, a new language developed by Dennis Ritchie.
• Being written in this high-level language greatly decreased the effort needed to port it to new machines
• 1977 There were about 500 Unix sites world-wide.
• 1980 BSD 4.1 (Berkeley Software Development)
• 1983 SunOS, BSD 4.2, System V
• 1988 AT&T and Sun Microsystems jointly develop System V Release 4 (SVR4). This later developed into UnixWare and
Solaris 2.
• 1991 Linux was originated.
What is LINUX
• Linux is a free Unix-type operating system originally created by Linus
Torvalds with the assistance of developers around the world.
• It originated in 1991 as a personal project of Linus Torvalds, a Finnish
graduate student.
• The Kernel version 1.0 was released in 1994
• Developed under the GNU General Public License , the source code for Linux
is freely available to everyone.
UNIX File System
File System
• Looks like an inverted tree
• Root directory /
• Each node is either a file or a directory
• Path name
Absolute path - start from root /home/user/myfiles
Relative path - start from current location ./work/lab1
. The current directory
.. The parent of current directory
5
Spaces
• Spaces are interpreted by the shell as special characters that separate
command line arguments and options. So before we even present the structure
of commands, keep that in mind.
6
Access Permission of File/Directory
• One can easily view the permissions for a file by invoking a long format listing using the command
ls -l.
• For instance, if the user user1 creates an executable file named test, the output of the command ls
-l test would look like this:
• -rwxrwxr-x 1 user1 student Sep 26 12:25 test
• The first symbols define owner, second group and last all users.
• The permissions of the file can be changed using chmod command
• chmod -R ### <filename or directory>
• -R is optional and when used with directories will reverse all the sub-directories of the target
directory changing ALL the permissions to ###.
• The #'s can be:
• 0 = Nothing
1 = Execute
2 = Write
3 = Execute & Write (2 + 1)
4 = Read
5 = Execute & Read (4 + 1)
6 = Read & Write (4 + 2)
7 = Execute & Read & Write (4 + 2 + 1)
7
Unix Command Line Structure
• Format: command [options] [arguments]
• Arguments: action object
• Options: change the way it performs
• command -[option][option][option]
• ls -alR
• command -option1 -option2 -option3
• ls -a -l -R
8
Control Keys
• Used to perform special functions
• Ctrl-Key (^-Key)
^-U: “line-kill” signal
^-A: go to the beginning of the line
^-E: go to the end of the line
^-K: kill until the end of the line
• Key arrows for history
• Tab for auto completion
• To expand windows: alt + mouse right click on a window and drag
9
Directory Navigation
• cd Change directory
• ls list directory contents or file permissions
• mkdir make a directory
• pwd print working ( current ) directory
• rmdir remove a directory
• touch create a file
10
cd
#cd meaning change directory
• cd
• cd ..
• cd ../..
• cd /fullpath (there is a slash at the beginning )
• cd relativepath ( no slash at the beginning )
• cd ~ ( to the user home directory)
11
mkdir and rmdir
• mkdir
• mkdir –p (creates the intermediate (parent) directories as needed)
• rmdir
• Directory must be empty, unless you use rmdir –f
• rmdir –rf (to remove a directory recursively and forcefully)
12
ls
• ls –a lists all file, including those beginning start with a dot (.)
• ls –d lists only names of directories, not the files in the directory
• ls –l “long listing” + shows symbolic links ( l )
• Letters guide
• Permissions:
• r meaning read permission
• w meaning write permission
• x meaning execute permission
• - meaning no permission
13
Linux File Viewing (1)
$ cat parts_file $ grep -i nut parts_file
C1987653 Wing Nut Wafer Supplies .83 360 C1987653 Wing Nut Wafer Supplies .83 360
C2345643 3/4" nut RC Electronics .42 120 C2345643 3/4" nut RC Electronics .42 120
Z2365432 1/4" nut Global House .25 620 Z2365432 1/4" nut Global House .25 620
Z2367654 1/5“muff RC Electronics.25 540
$ grep -ic nut parts*
$ grep nut parts* 3
C2345643 3/4" nut RC Electronics .42 120 $ grep -l nut par*
Z2365432 1/4" nut Global House .25 620 parts_file
Linux File Viewing (2)
• $ grep root /etc/passwd
root:x:0:0:root:/root:/bin/bash
operator:x:11:0:operator:/root:/sbin/nologin
• $ grep -n root /etc/passwd -n - shows line numbers
1:root:x:0:0:root:/root:/bin/bash
12:operator:x:11:0:operator:/root:/sbin/nologin
• $ grep -c false /etc/passwd
-c - counts matches
7
Linux File Viewing (3)
$ grep -v bash /etc/passwd | grep -v nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
news:x:9:13:news:/var/spool/news:
mailnull:x:47:47::/var/spool/mqueue:/dev/null
xfs:x:43:43:X Font Server:/etc/X11/fs:/bin/false
rpc:x:32:32:Portmapper RPC user:/:/bin/false
nscd:x:28:28:NSCD Daemon:/:/bin/false
named:x:25:25:Named:/var/named:/bin/false
squid:x:23:23::/var/spool/squid:/dev/null
ldap:x:55:55:LDAP User:/var/lib/ldap:/bin/false
apache:x:48:48:Apache:/var/www:/bin/false
Linux File Viewing (4)
$ grep ^root /etc/passwd Lines starting with the string “root”
root:x:0:0:root:/root:/bin/bash
$ grep :$ /etc/passwd
Lines ending in ":"
news:x:9:13:news:/var/spool/news:
$ grep [yf] /etc/group
All the lines containing either a "y" or "f"
sys:x:3:root,bin,adm
character are displayed
tty:x:5:
mail:x:12:mail,postfix
ftp:x:50:
nobody:x:99:
floppy:x:19:
xfs:x:43:
Additional commands
• ctrl + c to abort task
• man < cmd > for manual page
• < cmd > -help
• < cmd > --help
• cp copy
• mv change files/folder name
• cat to use the file as input , usually to read
• echo to print
• head to take lines from start of a file
• tail to take lines from the end of a file
• which shows the real name behind alias
• touch to create a document
• grep to grep ( capture) a string
• awk
• sed
• tar archive
• history view command line history
18
piping
The following symbols control the input and output of command
lines:
•<
•>
• | ( the key above “enter” while pressing shift )
19
Special characters
• ~ “tilde” indicates your home directory: /home/you
• * “star”: wildcard, matches anything
• ? wildcard, matches any one character
• ! History substitution, do not use
• & run a job in the background, or redirect errors
• #% special characters for different programs.
• `\([“ back-quote, backslash, etc. special to shell
• _ underscore, use this instead of spaces!!!
20
For experimenting with the commands:
c p /u sr/d ic t /w o rd s .
Or
c p /u sr/s h a re /d ic t /w o rd s .
21
Editors
• Graphic and no graphic
• gedit - graphic
• vi - no graphic
22
.login & .cshrc
• .login - run every time we login in top our account
• [webb@micron-x04 ~]$ more .login
• #vncstatus
• /tools/common/bin/check_vnc.py
• .cshrc – run every time we open new window
• webb@micron-x04 ~]$ more .cshrc
• alias h history
• alias m less
• alias lt 'ls -lt'
• alias ltr 'ls -ltr'
• #source /eda_disk/cadence/sourcefiles/sourceme
• source /tools/common/cshrc
23
Connect to micron system
Part 1:
Get access to the system.
Every student will get email to sign NDA (Non-disclosure agreement).
The amil will be from:
The email will be like:
Don't start (part 2) Unix system for 1H after you get your document !!!!!!!!!!
24
Connect to micron system
.Unix connection and setup
1. Software to Install on Your Local Computer
•Windows & macOS
•PuTTY – for Windows
ohttps://www.putty.org/
•For Mac and Windows you can use Terminal and run
ossh <username>@micron-x01.eng
•TigerVNC -
ohttps://sourceforge.net/projects/tigervnc/files/stable/1.13.1/
•Connecting to the Server
If accessing from outside the university network, connect to the university VPN following the instructions given on https://computing.tau.ac.il/helpdesk/remote-
access/communication/vpn.
•Open PuTTY on your local computer
•Enter hostname micron-x01.eng.tau.ac.il and port 22.
•Enter username and password when prompted. These are the same as your Moodle credentials. The password is hidden, and the characters will not show
up when you type.
•When you login your screen will be:
login as: <userid>
<user-id>@micron-x01.eng.tau.ac.il's password:?????????
Last login: Tue Aug 3 14:01:28 2021 from <user-id>-Key already created
Key already in authorized keys file
Making sure key exists for host micron-x01
Making sure key exists for host micron-x02
Making sure key exists for host micron-x03
No existing VNC found
Starting new VNC
New 'micron-x02:1 (webb)' desktop is micron-x02:1
Starting applications specified in /a/home/cc/enginer/webb/.vnc/xstartup
Log file is /a/home/cc/enginer/webb/.vnc/micron-x02:1.log
Now you have new VNC (for example 'micron-x02:1).
If you get:
Try micron-x01, micron-x02, micron-x03 or micron-x04
25
Connect to micron system
•VNC connection
Open your TigerVNC and get window:
Enter the session (micron-x02.eng.tau.ac.il:1) set for you (in yellow up) and do connect
You will get window:
Put your username, password, and new VNC will be OPEN.
Open terminal and type advvlsi and press enter
Now you can work on tools needed.
26