Anda di halaman 1dari 20

PRESENTATION ON

UNIX COMMANDS

By
Dilipa T M
3rd BCA
Regno-15B51409
TYPES OF UNIX COMMANDS:
 General purpose Commands

 Directory related commands

 File related commands

 Process related commands


GENERAL PURPOSE COMMANDS
1. cal- CALENDER
 Syntax :
cal[[month]year]
 The cal command can be invoked to see the
calendar of any specific month or a complete year.
 $cal- Displays the calendar of the current month.
 $cal 01 2017-Displays the calendar of January
2017
2. date- SYSTEM DATE
 Syntax :
$date
 The date command displays the current date
and time to the nearest second.
3. echo-TO DISPLAY A MESSAGE
 Syntax :

echo [option]….[string]…
 Used in shell scripts to display messages on the
terminal, or to issue prompts for taking input from
the user. It can also used to display shell variables.
4. printf – FORMATED OUTPUT
 Syntax :

printf “format_string”
 Its an alternative to echo and used to write formatted
output.
 Except in the BASH shell, printf command is an
external command.
 The command can be used the same way as echo.
5. tput – RESPOSITIONING THE CURSOR.
 Syntax :
$tput option
 tput has some useful functions that help in
positioning the cursor at specific location pr for
highlighting your text.
6. bc – THE CALCULATOR
 The bc command is less friendly, extremely
powerful command to perform accurate
calculations.
7. passwd – CHANGING THE PASSWORD
 Syntax :
passwd
 The passwd command is used to change
password.
8. tty – TERMINAL DETAILS
 Syntax : $ tty

 In Unix, even terminals are treated as files, it is


reasonable to except a command that tells you
the filename of the terminal you are using.
 The command is simple and needs no
arguments.
9. uname – MACHINE’S NAME
 Syntax :
$ uname
 uname command displays features of the
operating system running on your machine.
 By default, it displays the name of the operating
system.
10. who – DETAILS OF ACTIVE USERS
 Syntax : who[option][arguments]

 who is regularly used by the system


administrator to minor whether terminals are
being properly utilized. It also offers a number
of other options that are quite useful for him.
 The who command displays a multi-columnar
output.
11. man command – UNIX COMMAND MANUAL
 The man command which is short for manual
providers in-dept information about the
requested command or allows users to search
for commands related to a particular keyword.
DIRECTORY RELATED COMMANDS
1. pwd-(The present working directory)
 pwd is a command that prints the absolute pathname of
our current working directory.
 Syntax:
$pwd
/home/kfgsc
2. ls-command: ls command is used to list all the files
and directories contained in the specified directory.

$ls-Displays all files and directories in the current


directory.

ls/usr/john-displays all files and directories in the


/usr/john directory.

$ls-1-long listing of files and directories in the current


directory.
3. cd-( changing the directory):
cd command is used to move from one directory to
another.
This command uses a pathname as its argument. The
pathname can be either a relative pathname or an
absolute pathname.
a) . Means the current directory.
b) .. Means the parent directory.
c) A plain cd without pathname brings back to our
home directory
 Syntax:

$cd directory name


4. mkdir – (making directory)
mkdir command is used to create new directiones.
 Syntax:

$mkdir directory name

5. rmdir-(Removing directories)
 The rmdir command removes one or more directories
or sub-directories.
 When directories are removed, care should be taken to
remove them from lower to higher level. Further
directories can be removed only when they are empty.
 Syntax:

$rmdir directory name


6. mv command(move):
mv command is used to change the name of
a file (or) a directory.

 Syntax: $mv dir1 dir2


 This command renames the dir1 directory to dir2
directory.
PROCESS RELATED COMMANDS
 Ps Command:
The ps command displays a list of current process and
their properties.
 Syntax:
$ps

The output form ps shows four columns by default.

1) PID :is short form of process ID, a number which uniquely identifies the
process on the system.

2) TTY :field shows the terminal associated with the process.

3) TIME: field displays the total amount of CPU time , the process has used.

4) CMD :field shows the name of the command associated with the process.
FILE RELATED COMMANDS
1. cat command : To display the contents of a
text file on the screen use cat(concatenation)
command.
 $cat sample – Displays the contents of a
sample file.
 $cat>rhyme
^d
* This command will create a text file rhyme
with the text typed.
* The ^d(ctrl + d) typed on a new line will
signal the end of the user input.
 $cat>>rhyme
up above the world so high
likw a dimond in the sky.
^d
*This command will append the typed text to the
existing rhyme file.
 $cat data1 data2

This is content of data1 file.


This is content of data2 file.
*The cat command also display more than one
file.
*The command dispalys the content of data1
file & data2 file.
2. cp command (copy) : To copy the contents of one
file to another use cp (copy) command.
 Syntax :
$cp file1 file2
*The content of file1 are copied to a new file
file2.

3. rm command : To delete a file use rm command.


 Syntax :

$rm file1
* This command deletes the file1.
4. mv command : To change the name of a
file.(rename).
 Syntax :

$mv file1 file2


*The file1 is renamed as file2.

5. wc command : To count the no of lines,words and


characters in a file.
 Syntax :

$wc file1
8 46 125 file1
lines words chars
nohup Command:

 When a user logs with one or more processes still


running in the background, then these processes will
die an unnatural death.

 When the user does not want to hang up the


background process even when user logs out, the
nohup command is used.

top Command:

 Top command is another usefull command to check the


processes that are using the most CPU time, memory
etc.
nice Command:

 The priority of a process can be made lower by using


the nice command.

 Syntax:
$nice -10 cat test.dat

The priority of a process can be increased only by the


system administrrator or the supervisor.
This is done by using double minus(--) sing.

 Syntax:
$nice --10 cat test.dat
time Command:

 The time command is used to find out, how efficiently


the programs use the system resources.

 The output consis of 3 values:

1. Real time is the time interval between invocation


and termination of the process.

2. User time is the time taken by the program to


execute itself.

3. Sys time indicates the time taken by the kernel to


execute the user process.
Process Termination:

There are situations when the user has to terminate a


process prematurely.
 kill Command:
Syntax :
$kill PID
$kill 295

 Termination of a process forcibly is called killing a


process.

 A background process can be terminated using the kill


command.

Anda mungkin juga menyukai