[Unix] Basics from www.asic-world.com Sesson 1

Posted on Updated on

To note: all the information is distilled from http://www.asic-world.com, which is a very helpful website for whoever newbies or oldbies;).

3 main components: kernel, shell, utility programs(or commands)

Most commonly available shells:

  • Bourne shell (sh)
  • C shell (csh)
  • Korn shell (ksh)
  • TC shell (tcsh)
  • Bourne Again shell (bash)

Special Characters:




initiates command execution


separates commands on same line

( )

groups commands or identifies a function


executes a command in the background




redirects standard output


appends standard output


redirects standard input


wildcard for any number of characters in a file name


wildcard for a single character in a file name


quotes the following character

quotes a string preventing all substitutions

quotes a string allowing variable and command substitution


performs command substitution

[ ]

denotes a character class in a file name


references a variable

{ }

command grouping within a function


executes a command (if at beginning of line)


begins a comment

Control Keys:




erase everything you’ve typed on the command line


stop/kill a command


backspace (usually)


suspend a command


stop the screen from scrolling


continue scrolling


exit from an interactive program (signals end of data)

File System:


Typical Contents


The “root” directory


Essential low-level system utilities


Higher-level system utilities and application programs


Superuser system utilities (for performing system administration tasks)


Program libraries (collections of system calls that can be included in programs by a compiler) for low-level system utilities


Program libraries for higher-level user programs


Temporary file storage space (can be used by any user)

/home or /homes

User home directories containing personal file space for each user. Each directory is named after the login of the user.


UNIX system configuration and information files


Hardware devices


A pseudo-filesystem which is used as an interface to the kernel. Includes a sub-directory for each active program (or process).





type is a single character which is either ‘d’ (directory), ‘-‘ (ordinary file), ‘l’ (symbolic link), ‘b’ (block-oriented device) or ‘c’ (character-oriented device).


permissions is a set of characters describing access rights. There are 9 permission characters, describing 3 access types given to 3 user categories. The three access types are read (‘r’), write (‘w’) and execute (‘x’), and the three users categories are the user who owns the file, users in the group that the file belongs to and other users (the general public). An ‘r’, ‘w’ or ‘x’ character means the corresponding permission is present; a ‘-‘ means it is absent.


links refers to the number of filesystem links pointing to the file/directory (see the discussion on hard/soft links in the next section).


owner is usually the user who created the file or directory.


group denotes a collection of users who are allowed to access the file according to the group access rights specified in the permissions field.


size is the length of a file, or the number of bytes used by the operating system to store the list of files in a directory.


date is the date when the file or directory was last modified (written to). The -u option display the time when the file was last accessed (read).


name is the name of the file or directory.

Command makeup:


ls -l | more //make the list longer than one page

chmod permission-traids filename //change access permissions

u = user, g = group, o = other, a = all

+/- = add/remove

r/4 = read, w/2 = write, x/1 = execute (e.g. rwx is 7, rw- is 6)

Specifying multiple filenames:

  • [m-z]*[a-l] matches any filename that begins with a letter from ‘m’ to ‘z’ and ends in a letter from ‘a’ to ‘l’.
  • {/usr,}{/bin,/lib}/file expands to /usr/bin/file /usr/lib/file /bin/file and /lib/file.

Quotes (one type of characters):

  • Try insert a ‘\’ in front of the special character.
  • Use double quotes (“) around arguments to prevent most expansions.
  • Use single forward quotes (‘) around arguments to prevent all expansions.
  • (`) pass the output of one command as the input to another command, e.g.

$ hostname


$ echo this machine is called `hostname`

this machine is called asic-world


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s