message on the terminal. Syntax :- $echo message to print in quotes {quotes would not be displayed} Example :-$echoI am Learning Linux Ubuntu Output :- I am Learning Linux Ubuntu The echo command is also used to display value of variables.
Present Working Directory
(pwd)
We can move from one directory to other but
at a given time we can work only in one directory . That is knowm as current directory . To look into it Present Working Directory (pwd) command is used.
Syntax :- $pwd
Creating a Directory (mkdir)
mkdir command enables us to make new
directory.
Syntax :- $mkdir (name of directory)
Example :-$mkdir India Output :- Directory named India will be formed.
Remove Directory (rmdir)
With the help of this command unnecessary
directory can be removed. The directory to be removed not contain any other file or directory. Syntax :- $rmdir name of directory Example :- cd India $rmdir Gujarat Output :- First of all we must go to home directory and then by executing this command Gujarat named directory will be removed.
Calender (cal)
The cal command is used to show calender
of a specific month or that of whole year. To display calenderof whole year:Example :- $cal 2010 Output:-
To show calender of specific month of the
year:-
Example :- $cal 1 2014
Output :-
Date Command (date)
The date command is used to print
current date and time of the computer. Example :- $date press enter key Output :-
Deleting a file (rm)
The rm command is used to delete one or
more files. Syntax :- $rm filename Example :- $rm Abad Output :- Abad named file will be deleted.
To delete multiple files:Example :- $rm file1file2 file3
Output:-All three files will be deleted one by one.
Comparing two files (cmp)
The cmp command is used to compare two
files. Syntax :- $cmp filename1 filename2 Example :-$cmp file1 file2 Output :- It will compare files if both have same text otherwise it will show error and output would be -
Renaming a file (mv)
The mv command is used for renaming a file or directory.
Syntax :- $mv oldfilename newfilename Example :-$mv introduction introduction.txt Output :- The filename introduction will be renamed as introduction.txt.
The mv command is also used to move a file or group of
files to a different directory.
Example :- $mv file1 file2 my_dir
Output :- The files file1 and file2 will be moved to directory named my_dir.
Searching a File or Directory
(find)
The find command is used to locate forgotten
file or directory. Example :- $find-name Student Output :- Location of file named Student is to be located. Example :-$find-name stu* Output :- Name of files starting with stu will be displayed.