Академический Документы
Профессиональный Документы
Культура Документы
CAT COMMAND:
For eg.
DATE COMMAND:
For eg..
WHO AM I COMMAND:
It gives us detail regarding the login time and the system's
name for the connection being used.
For eg..
For eg..
[cse07340@localhost cse07340]$ who
cse07354 pts/0 Aug 27 11:28 (192.168.1.75)
cse07341 pts/2 Aug 27 11:30 (192.168.1.80)
cse07334 pts/4 Aug 27 11:31 (192.168.1.52)
cse07351 pts/7 Aug 27 11:35 (192.168.1.77)
cse07363 pts/10 Aug 27 11:36 (192.168.1.55)
cse07334 pts/12 Aug 27 12:04 (192.168.1.52)
cse07360 pts/11 Aug 27 11:37 (192.168.1.79)
cse07339 pts/1 Aug 27 11:39 (192.168.1.76)
cse07358 pts/5 Aug 27 11:39 (192.168.1.60)
cse07346 pts/14 Aug 27 11:40 (192.168.1.61)
cse07334 pts/15 Aug 27 11:48 (192.168.1.52)
cse07352 pts/3 Aug 27 11:50 (192.168.1.73)
cse07340 pts/17 Aug 27 11:50 (192.168.1.68)
cse07354 pts/18 Aug 27 11:52 (192.168.1.68)
PWD COMMAND:
For eg..
LS COMMAND:
For eg..
[cse07340@localhost cse07340]$ ls
! dsa12.c dsa3 oops10 oops17.cpp oops5.cpp
1 dsa13 dsa3.c oops10.cpp oops18 oops6
19 dsa13.c dsa4 oops11 oops18.cpp oops6.cpp
cse07340.c dsa17.c dsa7 oops14 oops2.c oops9.cpp
dsa dsa19 dsa7.c oops14.cpp oops2.cpp preeti
dsa1 dsa19.c dsa8 oops15 oops3 preeti.c
dsa10 dsa1.c dsa8.c oops15.cp oops3.cpp preeti.txt
dsa10.c dsa2 dsa9 oops15.cpp oops4 samrat
LS WITH OPTIONS:
ls -l:
Lists files in the long format. The files are displayed along with their
mode, no. of links, owner of the file, file size, modification date and time and filename.
For eg..
[cse07340@localhost cse07340]$ ls -l
total 852
-rw-r--r-- 1 cse07340 cse2007 472 Mar 31 12:45 !
-rw-r--r-- 1 cse07340 cse2007 406 Apr 1 11:56 1
-rwxr-xr-x 1 cse07340 cse2007 12127 Oct 16 2008 19
-rw-r--r-- 1 cse07340 cse2007 248 Jun 25 15:35 1.c
-rw-r--r-- 1 cse07340 cse2007 172 Jun 25 17:10 2.c
-rw-r--r-- 1 cse07340 cse2007 254 Jun 30 15:27 a.c
-rwxr-xr-x 1 cse07340 cse2007 11570 Jun 30 16:23 a.out
-rw-r--r-- 1 cse07340 cse2007 95 Jun 30 16:23 b.c
-rw-r--r-- 1 cse07340 cse2007 51 Aug 13 12:19 cse07340
-rw-r--r-- 1 cse07340 cse2007 0 Aug 13 12:15 cse07340.c
-rw-r--r-- 1 cse07340 cse2007 722 Oct 23 2008 dsa
ls -a:
For eg..
[cse07340@localhost cse07340]$ ls -a
! dsa12.c dsa5.c oops14 oops5
. dsa13 dsa6 oops14.cpp oops5.cpp
.. dsa13.c dsa6.c oops15 .oops5.cpp.swo
1.c dsa15 .dsa7.c.swp oops16 oops7
2.c dsa15.c dsa8 oops16.cpp oops7.cpp
.2.c.swp dsa16 dsa8.c oops17 oops8
a.c dsa16.c dsa9 oops17.cpp oops8,cpp
a.out dsa17.c dsa9.c oops18 oops8.cpp
.bash_history dsa19 .emacs oops18.cpp oops9
.bash_logout dsa19.c .gtkrc oops19 oops9.cpp
ls -al:
For eg..
CD COMMAND:
It is used to change from the working directory to any other directory
specified.
For eg..
[cse07340@localhost cse07340]$ cd ..
[cse07340@localhost home]$
MKDIR COMMAND:
For eg..
[cse07340@localhost cse07340]$ ls
cse07340.c dsa17.c dsa7 oops14 oops2.c oops9.cpp
dsa dsa19 dsa7.c oops14.cpp oops2.cpp preeti
dsa1 dsa19.c dsa8 oops15 oops3 preeti.c
dsa10 dsa1.c dsa8.c oops15.cp oops3.cpp preeti.txt
dsa10.c dsa2 dsa9 oops15.cpp oops4 samrat
RMDIR COMMAND:
This is used to remove a directory specified in the command line.
It requires the specified directory to be empty before removing it.
For eg..
MV COMMAND:
It is used to rename and move ordinary and directory files. To do this we
need both execute and write permissions.The old file no longer exists.
For eg..
#include<stdio.h>
#include<stdlib.h>
main()
{
char arr[50],ch;
FILE *ptr;
ptr=fopen("swapping.c","w"); //open the file
if(ptr==NULL)
{
printf("Unable to open the file");
}
else
{
printf("Enter a character,press enter");
while(ch!='\n')
{
ch=getchar();
putc(ch,ptr);
}
fclose(ptr);
}
}
RM COMMAND:
For eg..
For eg..
CP COMMAND:
It is used to create duplicate copies of ordinary files.
For eg..
COMM COMMAND:
In this command the common matter between two files are shown.
For eg..
For eg..
HEAD COMMAND:
For eg..
Hello
How are u?
What is your name?
My name is samrat.
What is this?
This is a book.
What are your hobbies?
Singing
Dancing
Surfing net
The above eg displays the first two lines of the file.
Hello
How are u?
Hello
How are u?
What is your name?
TAIL COMMAND:
For eg..
Hello
How are u?
What is your name?
My name is nannu.
What is this?
This is a book.
What are your hobbies?
Singing
Dancing
Surfing net
Listening music
What is your real name?
My real name is Kanika chugh?
SORT COMMAND
The sort filter arranges the input from the Standard Input in the
alphabetical order. The options available with sort are -r, -f, -n,
-b, -t etc.
For eg..
yellow
orange
green
skyblue
blue
red
Sort -n
5
8
9
12
25
33
35
58
65
Sort -f
When the sort command is used with -f option, the case
distinction is ignored and the output is arranged in alphabetical order.
Sort –u
This option will remove duplicate lines from the input and
display the output.
Output. Using this sort option we will be able to redirect the contents to the
file mentioned.
GREP COMMAND
For eg..
What is this?
This is a book.
Blue
Orange
Skyblue
blue
Grep -v
Yellow
Red
Green
Grep -c
Grep -n
2: orange
4: skyblue
5: blue
FGREP COMMAND:
FGREP stands for"Fixed GREP". This command is used to extract only fixed
strings without the use of any regular expression.fgrep used with -x option to
axtract those lines which match the string exactly.
For eg..
For eg..
In the above example, the output of command '"who" is passed as the input to the "wc "
command and the result is displayed.
• The output of the above command will be the display of the first three lines of the
file named items.
CUT COMMAND:
One particular field from any file or from output of any command canbe extracted and
displayed using the cut command. A single character can also be extracted by using the -c
option of the cut command.
For eg..
In the above command "-d" represents the "delimiter" or the field separator.
The option "-f" is followed by the list of fields that have to be displayed.
PASTE COMMAND:
It merges the contents of two files into a single file. It reads a line
from each file list specified and combines them into a single file.
For eg..