Links In Linux

To give a pointer to the source file called a link.

In Unix/Linux two types of links.

  • Soft links
  • Hard links.

Soft links

The inode number of the source file, link file are different.

  • It can be created across the file system.
  • Editing of the original file will be replicated in the link files.
  • The size of the soft link file equals the number of characters in the original file path.
  • If the source file is deleted the link file will not be accessible.
  • It is also be called a shortcut link

Syn: $ ln-s<source file> <link file>

Ex: $ ln-s/backup/linux /root/desktop/linux

Hard links

à Source file, link file has same inode numbers.

  • It can’t be created across the file system.
  • Editing of the original file will replicate in the link files.
  • The size of the hard link file is the same as the original file.
  • The source file is deleted the link file we can access.
  • It is a backup link.

Syn: $/n<source file><link file>

Ex: $ /n/root/ backup/root/ desktop/ backup  

*Shell concept: Shell is a command-line interpreter. The shell access request from the user and the checks command existence, if the command exists then it converts into kernel understandable language (Machine language) and it sends the given request to kernel.

The shell access interface b/w user and kernel

Inclined to build a profession as Linux Developer? Then here is the blog post on, explore Linux Training

Types of shells 

Shell nameDeveloped ByPromptInterpreter name
Bourne shellStephen Bourne$sh
Korn ShellDavid korn$ksh
C shellBill joy%csh
Bash shellStephen Bourne$bash
Z shellpaul$z sh

Note: The advanced version of the Bourne shell is the bash shell.

  • Bash means “Bourne again shell”
  • Bash shell is the default in Linux.

Default shell name                                                 Flavour name

Bash Shell                                                                  Linux

Bourne Shell                                                              SCo_Unix, Solaris, HP_UX

Korn Shell                                                                  IBM_AIX

C shell                                                                        IRIX (Silicon Graphics)  

Default shell nameFlavour name
Bash ShellLinux
Bourne ShellSCo_Unix, Solaris, HP_UX
Korn ShellIBM_AIX
C shellIRIX (Silicon Graphics)

Features of shells

  • Word completion
  • Command History.
  • Command alias.

To check the shells:

#cat / etc/shells

To check the parent shell of the current user:

# echo $ SHELL  

To view the available shells:

#Cd /bin #ls  *  sh

To shift from bash shell to sh shell:

#sh

To shift from sh shell to k shell:

#ksh

To check the current working shell:

#echo $ʘ

To exit the shell:

#exist

 

Linux Tutorials

 

Command completion:

Linux automatic command completion is a tool or program that can identify what you are typing in the Linux command line terminal and can complete that command, words, or sentence for you. This is really cool feature in Linux

  • When the <TAB> key is pressed, any command starting with the given string will be completed by the system automatically.
  • For multiple commands that starting with the given string, pressing the <TAB> key twice will list down all those matched files or commands.
  • If there are no match of any command, files, or folders, then, the automatic word completion will not show, a ‘ting’ sound will buzz.

Ex: $cd /var/l<tab>Lib/lock/ log/

Command History:  

The history command performs one of several operations related to recently – executed commands recorded in a history list. Each of these recorded commands is referred to as an ‘event’, when specifying an event to the history command.  

$history

$history 10

$history –c                        Lock the history.

$history –r                        Unlock history.

$rm.bash_history              Removes the history

Command alias:

  • Alias is a built-in shell command in Linux/Unix operating systems.
  • It can save you a lot of typing by assigning a name to long commands.
  • The alias command can be useful if you want to create a ‘shortcut’ to a command.

Syn: Alias name=’command’

Ex:   

$alias                           U= user add

$alias                           C= Clear

$alias                           Display alias list

$unalias U                   Disable alias

$Vim. bashrc               Permanent alias names

For an in-depth understanding of Linux click on