File and
Directory Structure:
The Directory Structure of Unix/Linux based operating systems
is Inverted Tree, where roots(/) are at the top and rest comes down
heretically.  The file system looks like:
- / — the slash / character alone denotes the root of the virtual filesystem tree.
 
- /bin — stands for "binaries" and contains certain fundamental utilities, such as ls or cp, needed by all users.
 - /sbin — stands for "system (or "superuser") binaries" and contains fundamental utilities, such as init, usually needed to start, maintain and recover the system.
 - /etc — contains configuration files and system databases.
 - /dev — stands for "devices". Contains file representations of peripheral devices.
 - /home — contains the home directories for the users.
 - /mnt — contains filesystem mount points.
 - /lib — contains system libraries.
 - /root — the home directory for the super-user root.
 - /tmp — a place for temporary files. Many Unices clear this directory upon start up.
 - /usr — originally the directory holding user home directories, its use has changed, and it now holds executables, libraries, and shared resources that are not system critical, like the X Window System, KDE, Perl, etc. (The name "Unix System Resources" is a post hoc backronym). However, on some UNIX systems, some user accounts may still have a home directory that is a direct subdirectory of /usr, such as the default as in Minix.
 - /var — a short for "variable." A place for files that may change often.
 - /proc — contains all processing data (Process information about a running operating system).
 - /opt — contains add-on software.
 - /media — default mount point for removable devices.
 - /srv — server data (data for services provided by system).
 - /boot — contains all the important files which are required for successful booting process.
 - /sys — contains information related to hardware.
 
For more
information Please follow: http://en.wikipedia.org/wiki/Unix_directory_structure
Shortcuts
of Shell
Following are the mail shortcuts that can be used in the
K-shell of AIX for more productiveness:
- To navigate with the prev and next commands : ESC + j and ESC + k
 - To navigate right to left and vice-versa in a command : ESC + h and ESC + l
 - To inserts chars between a already written command: ESC + h/l (this is to navigate) + i (this is to insert). Remember that the INSERT key doesn’t work here on shell for inserting.
 - To auto-complete a file or directory name: ESC + \
 
VI editor
- VI is an Editor used to edit files in the UNIX based system. Following are the mostly used features of VI:
 - To open a file in VI editor : $vi <filename>
 - Note: This will open the file if it is present in the current directory or else it will create the file if the directory is not mentioned.
 - To insert in to the file once the file is open for editing : press i or press a or press INSERT Key
 - To quit from the vi editor one need to come to normal mode from the insert mode. Use ESC key to come to normal mode from Insert mode.
 - :q! --> to quit forcefully
 - :w! --> to write the content of the last edit to the file, forcefully
 - :wq! --> to write the content of the last edit to the file as well as quit, forcefully.
 - Use Following commands in Normal mode:
 - :set number --> to see the line numbers
 - :set nonumber -->to remove the line numbering
 - /<word> --> to search the word in the file
 
Basic
Commands:
Following is the list of basic commands that can be used on
almost all the UNIX based systems and enhances the productivity:
- $cd --> To come to users own home directory from any location
 - $cd <directory path> --> To go to the specified directory path
 - $cd .. --> To go one level up in the directory structure.
 - $cd - --> To go the previous directory that one is working before working to the current directory.
 - Note:Please note the SPACE between cd .. and cd –
 - $touch <filename> --> Creates empty files, if the file is not present. If the file is present the access time stamp will be changed.
 - $mkdir <dir-name> --> To create a directory.
 - $mkdir –p <dir1/dir2/dir3> --> To create recursive directories. Using this dir2 is created in dir1 and dir3 is created in dir2.
 - $rm <filename> --> To delete a file. One will be prompted yes or no when this command is used.
 - $rm –rf <filename or dirname> --> To delete files or complete directories. It won’t prompt for yes or no before deleting the file or directory.
 
- $man <command> --> To get information about a command. For example $man grep will give all the information regarding the grep command.
 - $cp <source> <destination> --> To copy a file or directory from source to destination.
 - $mv <source> <destination> --> To move a file or directory form source to destination.
 - $clear --> clears the prompt
 - $cat <filename> --> to view the content of the file.
 - $date --> prints the date on the prompt
 - $echo “String” --> prints the String on the prompt.
 - $grep <pattern> <filename> --> to search a pattern of strings within a filename.
 - Note: The various options of grep can be easily understood using the man page ie $man grep.
 - $cat <filename> | more --> To view a file which is more than one page long. RETURN (ENTER) key is used to scroll one line and SPACE key is used to scroll 1 Page.
 - $more <filename> --> works same as the above command.
 
Shell and
Shell Script
A UNIX shell is a command-line interpreter or shell
that provides a traditional user interface for the UNIX based operating system
and for Unix-like systems. The shell that a user is using can be found using
$echo $SHELL
/bin/ksh
This means that K-shell is used by the user.
The most widely used Shells are as follows:
- Korn Shell --> ksh
 - Bourne Shell --> bsh
 - Bourne Again Shell --> bash
 - C- Shell --> Csh
 
For reading and referring to the Shell Scripting please
follow the below mentioned links as it is a long topic and cannot be covered in
this completely.
Use of $
Following
the table how $ can be used in a Shell Script.
| 
   
$1
  - $9 
 | 
  
   
These
  variables are the positional parameters. 
 | 
 
| 
   
$0 
 | 
  
   
The
  name of the command currently being executed. 
 | 
 
| 
   
$# 
 | 
  
   
The
  number of positional arguments given to this invocation of the shell. 
 | 
 
| 
   
$? 
   
 | 
  
   
The
  exit status of the last command executed is given as a decimal string. 
  When a command completes successfully, it returns the exit status of 0
  (zero), otherwise it returns a non-zero exit status. 
 | 
 
| 
   
$$ 
 | 
  
   
The
  process number of this shell - useful for including in filenames, to make
  them unique. 
 | 
 
| 
   
$! 
 | 
  
   
The
  process id of the last command ran in the background. 
 | 
 
| 
   
$- 
 | 
  
   
The
  current options supplied to this invocation of the shell. 
 | 
 
| 
   
$* 
 | 
  
   
A
  string containing all the arguments to the shell, starting at $1. 
 | 
 
| 
   
$@ 
 | 
  
   
Same
  as above, except when quoted. 
 | 
 
No comments:
Post a Comment