KEMBAR78
Know the UNIX Commands | PPTX
U N I X
made by B Chari K working in semiconductors domain
UNIX OS
 Unix is a multi-user, multi-tasking, multi-
processing, efficient, fast and very powerful
operating system.
 The OS is build on top of the kernel, and
consists of
additional commands,
utilities,
command interpreters or shells,
language compilers and debuggers,
text processors etc.
B Chari K
Kernel
 The kernel is the heart of the any operating
system.
 This is relatively small piece of code that
directly sits on the hardware.
 It is a collection of programs that are mostly
written in C
B Chari K
Kernel Architecture
B Chari K
Kernel Tasks
B Chari K
Shell Prompt
 Shell provides an interface to the user and UNIX
OS.
 A shell is an environment in which we can run our
commands, programs, and shell scripts.
 It gathers input from user and executes programs
based on that input.
B Chari K
Different shells
 Different flavor of
shells, each has own
set of recognized
commands and
functions
 Borne shell(sh)
 Korn shell(sh)
 C shell
 TENEX C
shell(tcsh)
 Shells are usually
installed in /bin/B Chari K
Super User
 Unix is a case-sensitive operating system.
 A special account root that is reserved for the
system administrator or super user.
 It has all system resources, including all files,
directories, and data.
 The super user has full access and control
over every thing and a slight mistake can cause
irreparable damage to the system.
B Chari K
File Organization
B Chari K
File Organization
B Chari K
Absolute path & Relative path
 Absolute path : starts from root(/) and follow the
tree
 Relative path : starts from current directory
B Chari K
UNIX commands
Changing directory
 cd is used to change from
one directory to another
directory
cd ~  to home directory
cd /  to root directory
cd -  to last directory
cd ..  to immediate parent
directory
cd <dir_name> or cd <path>
pwd  know the path for
current directory
B Chari K
Creating and Removing Directories
 mkdir creates a
directory
mkdir <dir_name>
mkdir path>/<dir_name>
 rmdir removes a
directory
rmdir <dir_name>
B Chari K
Listing Files
 ls list the files and
directories in current
directory
 ls –l  long listing the all
details of files
 ls –a  hidden files
 ls –t  sort the files
 Ls -R recursively
displays all files in
subdirectories
B Chari K
Creating Files
touch is used to create
new, empty files
touch <file_name>
The argument to the
command taken as new
file name
Touch
<fie1><file2><file3>
Can create any no.of files
simultaneously
This command can
change timestamps for
existing files
B Chari K
Creating and Editing files
vi editor to create an
ordinary files
vi <file_name>
Press i - come into insert
mode
esc - come to command
mode
:wq to save and come out
of file completely.
vim, gvim, gedit, nedit,
emacs are some of editors
B Chari K
Display or concatenate files
cat displays the file
content on terminal.
Or display two files’
contents together
cat file1 file2
Combines and displays
file1 and file2
cat file1 file2 > filex
Moves file1 and file2
to filex
B Chari K
File Permissions
B Chari K
Chmod 755 <file1>
Change permissions
chmod alters the
permissions on files and
directories using either
symbolic or octal numeric
codes.
+ to add a permission
- to add a permission
= to assign a permission
chmod u=rw <file1>
chmod u+x, g+w, o-w
<file1>
B Chari K
Change Permissions
B Chari K
Copying and Moving files
cp used to make
copies of files and
directories
Cp <source_file>
<destination_file>
Cp file1 file2 dir1
Copies file1 and file2
into dir1 directory
Cp –r dir1 dir2
Copies directories
using -r
B Chari K
Moving and Renaming files
mv used to change the
name of the files or move
the files into other
directories
mv file1 file2
Renames the file1 to
file2
mv file1 file2 dir1
Moves file1 and file2
to dir1 directory
B Chari K
Getting help
man used to get the
manuals pages about the
command
man <command>
(or)
<command> --help
Info used to get the
description of all available
commands.
info
Info <command>
B Chari K
Removing files
rm is used to remove
files
rm <file1>
Deletes the existing file
rm -i <file1>
You will be asked that
you wish to be delete or
not
rm -r <directory>
Recursively deletes the
contents of directory,
its subdirectories and
deletes directory itself
B Chari K
Commands on files
Sort this command sort
and combines all the lines in
file
Sort -d <file1>
Sorts based on
dictionary order in which
letters, digits,
whitespaces considered
Sort -r <file1>
Reverse the order of
the combining sequence
diff display difference
between two files
Diff <file1> <file2>
Reports line by line
difference between the text
files
file tests named files to
determine the categories their
contents belongs to.
File <file1>
B Chari K
Display commands
echo prints the given
argument in standard output
device
echo “type a string”
head displays the head
or start of the file
head -number <file1>
Head -10 file1
taildisplays the tail or end of
the file
tail -number <file1>
Tail -20 <file1>
B Chari K
Display commands(more, less)
more display the large
file in one screenful at a time
more <file1>
Allows only forward
control
less similar to more
Less <file1>
Allows forward and
backward movement
more, less can also be
used for pattern searching
 more +/pattern <file1>
Less +/pattern <file1>
B Chari K
System resource commands
date report current
date and time
which reports path for
the specified command
which <command>
du report the disk
usage of specified file or
directory
du <dirname>
B Chari K
System resource commands
uname display or set the
name of the current machine
passwd change or set
the password
who report who is logged
in and what processes are
running
script saves everything that
appears on the screen to a file
until exit is executed.
script <file>
B Chari K
Find files of a specified name or
type
find searches for files in
a named directory and all its
subdirectories.
find . -type f -name “*.txt”
Searches current directory
for the files end with .txt
extension
find < > -type < > -name “pattern”
Path from where
You want to search
d – directory
f – files
l - link
B Chari K
Pattern Matching
grep searches for lines
containing specified pattern
grep <pattern>
<file_name>
grep -i <pattern>
<file_name>
For insensitive
search
grep -wocv <pattern>
<file>
-w Prints line which
have individual word
-o it prints only the
word
-c it gives the count
-v prints lines which
didn't match
B Chari K
Piping
 Connect two commands together so that the
output from one program becomes the input of
the next program.
 ls –l | grep “Aug”
 This would extract all the files created in August
month
B Chari K
T h a n k Y o u
made by B Chari K working in semiconductors domain

Know the UNIX Commands

  • 1.
    U N IX made by B Chari K working in semiconductors domain
  • 2.
    UNIX OS  Unixis a multi-user, multi-tasking, multi- processing, efficient, fast and very powerful operating system.  The OS is build on top of the kernel, and consists of additional commands, utilities, command interpreters or shells, language compilers and debuggers, text processors etc. B Chari K
  • 3.
    Kernel  The kernelis the heart of the any operating system.  This is relatively small piece of code that directly sits on the hardware.  It is a collection of programs that are mostly written in C B Chari K
  • 4.
  • 5.
  • 6.
    Shell Prompt  Shellprovides an interface to the user and UNIX OS.  A shell is an environment in which we can run our commands, programs, and shell scripts.  It gathers input from user and executes programs based on that input. B Chari K
  • 7.
    Different shells  Differentflavor of shells, each has own set of recognized commands and functions  Borne shell(sh)  Korn shell(sh)  C shell  TENEX C shell(tcsh)  Shells are usually installed in /bin/B Chari K
  • 8.
    Super User  Unixis a case-sensitive operating system.  A special account root that is reserved for the system administrator or super user.  It has all system resources, including all files, directories, and data.  The super user has full access and control over every thing and a slight mistake can cause irreparable damage to the system. B Chari K
  • 9.
  • 10.
  • 11.
    Absolute path &Relative path  Absolute path : starts from root(/) and follow the tree  Relative path : starts from current directory B Chari K
  • 12.
  • 13.
    Changing directory  cdis used to change from one directory to another directory cd ~  to home directory cd /  to root directory cd -  to last directory cd ..  to immediate parent directory cd <dir_name> or cd <path> pwd  know the path for current directory B Chari K
  • 14.
    Creating and RemovingDirectories  mkdir creates a directory mkdir <dir_name> mkdir path>/<dir_name>  rmdir removes a directory rmdir <dir_name> B Chari K
  • 15.
    Listing Files  lslist the files and directories in current directory  ls –l  long listing the all details of files  ls –a  hidden files  ls –t  sort the files  Ls -R recursively displays all files in subdirectories B Chari K
  • 16.
    Creating Files touch isused to create new, empty files touch <file_name> The argument to the command taken as new file name Touch <fie1><file2><file3> Can create any no.of files simultaneously This command can change timestamps for existing files B Chari K
  • 17.
    Creating and Editingfiles vi editor to create an ordinary files vi <file_name> Press i - come into insert mode esc - come to command mode :wq to save and come out of file completely. vim, gvim, gedit, nedit, emacs are some of editors B Chari K
  • 19.
    Display or concatenatefiles cat displays the file content on terminal. Or display two files’ contents together cat file1 file2 Combines and displays file1 and file2 cat file1 file2 > filex Moves file1 and file2 to filex B Chari K
  • 20.
  • 21.
    Chmod 755 <file1> Changepermissions chmod alters the permissions on files and directories using either symbolic or octal numeric codes. + to add a permission - to add a permission = to assign a permission chmod u=rw <file1> chmod u+x, g+w, o-w <file1> B Chari K
  • 22.
  • 23.
    Copying and Movingfiles cp used to make copies of files and directories Cp <source_file> <destination_file> Cp file1 file2 dir1 Copies file1 and file2 into dir1 directory Cp –r dir1 dir2 Copies directories using -r B Chari K
  • 24.
    Moving and Renamingfiles mv used to change the name of the files or move the files into other directories mv file1 file2 Renames the file1 to file2 mv file1 file2 dir1 Moves file1 and file2 to dir1 directory B Chari K
  • 25.
    Getting help man usedto get the manuals pages about the command man <command> (or) <command> --help Info used to get the description of all available commands. info Info <command> B Chari K
  • 26.
    Removing files rm isused to remove files rm <file1> Deletes the existing file rm -i <file1> You will be asked that you wish to be delete or not rm -r <directory> Recursively deletes the contents of directory, its subdirectories and deletes directory itself B Chari K
  • 27.
    Commands on files Sortthis command sort and combines all the lines in file Sort -d <file1> Sorts based on dictionary order in which letters, digits, whitespaces considered Sort -r <file1> Reverse the order of the combining sequence diff display difference between two files Diff <file1> <file2> Reports line by line difference between the text files file tests named files to determine the categories their contents belongs to. File <file1> B Chari K
  • 28.
    Display commands echo printsthe given argument in standard output device echo “type a string” head displays the head or start of the file head -number <file1> Head -10 file1 taildisplays the tail or end of the file tail -number <file1> Tail -20 <file1> B Chari K
  • 29.
    Display commands(more, less) moredisplay the large file in one screenful at a time more <file1> Allows only forward control less similar to more Less <file1> Allows forward and backward movement more, less can also be used for pattern searching  more +/pattern <file1> Less +/pattern <file1> B Chari K
  • 30.
    System resource commands datereport current date and time which reports path for the specified command which <command> du report the disk usage of specified file or directory du <dirname> B Chari K
  • 31.
    System resource commands unamedisplay or set the name of the current machine passwd change or set the password who report who is logged in and what processes are running script saves everything that appears on the screen to a file until exit is executed. script <file> B Chari K
  • 32.
    Find files ofa specified name or type find searches for files in a named directory and all its subdirectories. find . -type f -name “*.txt” Searches current directory for the files end with .txt extension find < > -type < > -name “pattern” Path from where You want to search d – directory f – files l - link B Chari K
  • 33.
    Pattern Matching grep searchesfor lines containing specified pattern grep <pattern> <file_name> grep -i <pattern> <file_name> For insensitive search grep -wocv <pattern> <file> -w Prints line which have individual word -o it prints only the word -c it gives the count -v prints lines which didn't match B Chari K
  • 34.
    Piping  Connect twocommands together so that the output from one program becomes the input of the next program.  ls –l | grep “Aug”  This would extract all the files created in August month B Chari K
  • 35.
    T h an k Y o u made by B Chari K working in semiconductors domain

Editor's Notes