Vous êtes sur la page 1sur 9

BASIC UNIX COMMANDS

WORKING WITH FILES


CREATING A FILE
AIM
To create a file.

SYNTAX
$cat>filename

EXAMPLE
$cat>name

DESCRIPTION
This command is used to create a file.

COPY COMMAND
AIM
To copy a data from one file to another file.

SYNTAX
$cp <oldfilename> <newfilename>

EXAMPLE
$cp aaa bbb

DESCRIPTION
This command is used to copy a file from one to another file.

REMOVE COMMAND
AIM
To remove a file.

SYNTAX
$rm <filename>

EXAMPLE
$rm abc

DESCRIPTION
This command is used to remove the file.

MOVE COMMAND
AIM
To move a file from one directory to another directory.

SYNTAX
$mv <filename> <filename/directoryname>

EXAMPLE
$mv aaa bbb

DESCRIPTION
This command is used to move the file from one directory to another directory.

VIEW COMMAND
AIM
To view the content of the file.

SYNTAX
$cat <filename>

EXAMPLE
$cat xyz

DESCRIPTION
This command is used to view the contents of the file.

ADD COMMAND
AIM
To add the contents to the existing file.

SYNTAX
$cat>>filename

EXAMPLE
$cat>>aaa

DESCRIPTION
This command is used to add the contents to the existing file.

WORKING WITH DIRECTORIES


CREATE A DIRECTORY
AIM
To create a new directory.

SYNTAX
$mkdir directoryname

EXAMPLE
$mkdir book

DESCRIPTION
This command is used to create a new directory.

CHANGE COMMAND
AIM
To change the new directory.

SYNTAX
$cd directoryname

EXAMPLE
$cd flowers

DESCRIPTION
This command is used to change the new directory.

REMOVE DIRECTORY COMMAND


AIM
To remove a directory.

SYNTAX
$rm directoryname

EXAMPLE
$rm fruits

DESCRIPTION
This command is used to remove the directories.

PATH COMMAND
AIM
To find the path name of the current file.

SYNTAX
$pwd

DESCRIPTION
This command is used to display the path of the current file.

DATE COMMAND
AIM
To display the date in month and year.

SYNTAX
$date

DESCRIPTION
This command is used to display the date in month, year, day, hours, minutes and seconds.

WHO COMMAND
AIM
To see who are the user connected to the servers.

SYNTAX
$who

DESCRIPTION
This command is used to see who are the users connected to the server.

CALENDER COMMAND
AIM
To display the calendar with month and year.

SYNTAX
$cal month year

EXAMPLE
$cal 01 2011

DESCRIPTION
This command is used to display the calendar with month and year.

WHO AM I COMMAND
AIM
To know the system number.

SYNTAX
$who am i

DESCRIPTION
This command is used to know the system number.

CLEAR COMMAND
AIM
To clear the screen.

SYNTAX
$clear

DESCRIPTION
This command is used to clear the screen.

FILE COMMAND
AIM
To display the contents of more than one file.

SYNTAX
$more <file1> <file2>

EXAMPLE
$more aaa bbb

DESCRIPTION
This command is used to display the contents of more than one file.

SORT COMMAND
AIM
To sort the contents of file in a predefined order.

SYNTAX
$sort filename

EXAMPLE
$sort name

DESCRIPTION
This command is used to sort the contents of the file in preferred order.

ATTRIBUTES
A -> Display the numerical value order. R -> Display the reverse order. M -> The case distinction is ignored.

GREP COMMAND
AIM
This command is used for certain kind of pattern maching.

SYNTAX
$grep string filename

EXAMPLE
$grep earth planet

DESCRIPTION
This command is used for kind of patter for string.

ECHO COMMAND
AIM
This command is used to display the text.

SYNTAX
$echo text/variable

EXAMPLE
$echo hello

DESCRIPTION
This command is used to display echo command of the text.

WC COMMAND
AIM
To display the number of lines, words and character.

SYNTAX
wc l filename wc w filename wc c filename

DESCRIPTION
This command is used to display the number of lines, words and character.

LIST COMMAND
AIM
To list the current file in the directory.

SYNTAX
$ls filename

EXAMPLE
$ls aaa

DESCRIPTION
This command is used to list the current files in the directory.

ATTRIBUTES
$ls l -> List of files in long format.

$ls u -> Display the files in the order of last access time. $ls a -> It displays all the files and directories including hidden files. $ls p -> Put slash after the directories. $ls t -> Displays the file in order of modified time.

HEAD COMMAND
AIM
To display the specified lines in specified files.

SYNTAX
$head ~count <filename>

DESCRIPTION
This command is used to display the specified line in the specified file.

TAIL COMMAND
AIM
To retrive specified lines from given file is order we choose.

SYNTAX
$tail [+/- count] <filename>

EXAMPLE
$tail -3 book

DESCRIPTION
It is used to retrive specified line from given file in order we choose.

WILD CHAR COMMAND/PATTERN


AIM
To display the file starting with specified character.

SYNTAX
$ls [alphabet]*

DESCRIPTION
It is used to display the file starting with specified with specified character.

MAN COMMAND
AIM
Whenever the user needs help for a command it can be abstracted from the manual.

SYNTAX
$man[command]

EXAMPLE
$man cat

DESCRIPTION
It is used to help for a command, it can be abstracted manually.

DISPLAY FILES IN A PATTERN


AIM
To display the file starting with a to m.

SYNTAX
$ls[a-m]*

DESCRIPTION
It is used to display the file starting with a to m.

RESULT
Thus the basic unix commands are executed and the output is verified.

Vous aimerez peut-être aussi