General Commands You Should Know in Linux/Unix (1st Part)
There are some General commands that you should know, when you are starting with Linux. These commands are very useful and have diverse functions.
lets begin...
1. cal : cal command can be used to see the calender of any specific month or a complete year.
Syntax
cal [ [month] year]
* cal can be used without argument in that case it displays calender of the current month.
Example
-->cal //displays the calender of current month
--> cal 05 2012 //displays the calender of 5th month of 2012
--> cal 2012 //displays the calender whole 2012 year
2. date : date command display the current date of the system.
Syntax
date
Example
date
* 1st field represents day
*2nd field represents Month
*3rd field represents date
*4th field represents Current Time (24 hr clock)
*5th field represents Time Zone
*6th field represents year
date command can be used to display each field separately. This can be done using format specifier.Each format is preceded by + symbol followed by % operator and a single character describing the format.
a. date +%m //display month in numerical form
b. date +%h //display month name
c. date +"%h %m" //display month name and its numeric equivalent
other format specifiers are:
1. d - The day of the month(1-31).
2. y - The last two digit of the year.
3. H,M and S - The hour , minute and second respectively.
There are many more you can see them by typing date --help on the terminal.
3. --help : --help can be used with any command to know their options .
Syntax
command-name --help
Example
--> date --help
--> cal --help
4. man command can be used as an alternative of --help option. It is used to display documentation of the command. This include options used with command and other information also.
Syntax
man command-name
Example
--> man date
--> man cal
* press q to exist from man page.
5. info : info command serve the same purpose which man command do , but it contain lot more information than man does.
Syntax
info command-name
Example
--> info date
--> info cal
* press q to exist from info page
Difference between man and info
1. man contain less content than info.
2. man is older and info is newer and slowly replacing man.
3. man is typically a single page while info is spread across multiple pages and info allow navigation while man does not.
There are some General commands that you should know, when you are starting with Linux. These commands are very useful and have diverse functions.
lets begin...
1. cal : cal command can be used to see the calender of any specific month or a complete year.
Syntax
cal [ [month] year]
* cal can be used without argument in that case it displays calender of the current month.
Example
-->cal //displays the calender of current month
$ cal
January 2012
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
$
January 2012
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
$
--> cal 05 2012 //displays the calender of 5th month of 2012
$ cal 05 2012
May 2012
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
$
May 2012
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
$
--> cal 2012 //displays the calender whole 2012 year
$ cal 2012
2012
January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 1 2 3 4 1 2 3
8 9 10 11 12 13 14 5 6 7 8 9 10 11 4 5 6 7 8 9 10
15 16 17 18 19 20 21 12 13 14 15 16 17 18 11 12 13 14 15 16 17
22 23 24 25 26 27 28 19 20 21 22 23 24 25 18 19 20 21 22 23 24
29 30 31 26 27 28 29 25 26 27 28 29 30 31
April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 1 2 3 4 5 1 2
8 9 10 11 12 13 14 6 7 8 9 10 11 12 3 4 5 6 7 8 9
15 16 17 18 19 20 21 13 14 15 16 17 18 19 10 11 12 13 14 15 16
22 23 24 25 26 27 28 20 21 22 23 24 25 26 17 18 19 20 21 22 23
29 30 27 28 29 30 31 24 25 26 27 28 29 30
July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 1 2 3 4 1
8 9 10 11 12 13 14 5 6 7 8 9 10 11 2 3 4 5 6 7 8
15 16 17 18 19 20 21 12 13 14 15 16 17 18 9 10 11 12 13 14 15
22 23 24 25 26 27 28 19 20 21 22 23 24 25 16 17 18 19 20 21 22
29 30 31 26 27 28 29 30 31 23 24 25 26 27 28 29
30
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 1 2 3 1
7 8 9 10 11 12 13 4 5 6 7 8 9 10 2 3 4 5 6 7 8
14 15 16 17 18 19 20 11 12 13 14 15 16 17 9 10 11 12 13 14 15
21 22 23 24 25 26 27 18 19 20 21 22 23 24 16 17 18 19 20 21 22
28 29 30 31 25 26 27 28 29 30 23 24 25 26 27 28 29
30 31
$
2012
January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 1 2 3 4 1 2 3
8 9 10 11 12 13 14 5 6 7 8 9 10 11 4 5 6 7 8 9 10
15 16 17 18 19 20 21 12 13 14 15 16 17 18 11 12 13 14 15 16 17
22 23 24 25 26 27 28 19 20 21 22 23 24 25 18 19 20 21 22 23 24
29 30 31 26 27 28 29 25 26 27 28 29 30 31
April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 1 2 3 4 5 1 2
8 9 10 11 12 13 14 6 7 8 9 10 11 12 3 4 5 6 7 8 9
15 16 17 18 19 20 21 13 14 15 16 17 18 19 10 11 12 13 14 15 16
22 23 24 25 26 27 28 20 21 22 23 24 25 26 17 18 19 20 21 22 23
29 30 27 28 29 30 31 24 25 26 27 28 29 30
July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7 1 2 3 4 1
8 9 10 11 12 13 14 5 6 7 8 9 10 11 2 3 4 5 6 7 8
15 16 17 18 19 20 21 12 13 14 15 16 17 18 9 10 11 12 13 14 15
22 23 24 25 26 27 28 19 20 21 22 23 24 25 16 17 18 19 20 21 22
29 30 31 26 27 28 29 30 31 23 24 25 26 27 28 29
30
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 1 2 3 1
7 8 9 10 11 12 13 4 5 6 7 8 9 10 2 3 4 5 6 7 8
14 15 16 17 18 19 20 11 12 13 14 15 16 17 9 10 11 12 13 14 15
21 22 23 24 25 26 27 18 19 20 21 22 23 24 16 17 18 19 20 21 22
28 29 30 31 25 26 27 28 29 30 23 24 25 26 27 28 29
30 31
$
2. date : date command display the current date of the system.
Syntax
date
Example
date
$ date
Sun Jan 8 16:07:09 IST 2012
$
Sun Jan 8 16:07:09 IST 2012
$
* 1st field represents day
*2nd field represents Month
*3rd field represents date
*4th field represents Current Time (24 hr clock)
*5th field represents Time Zone
*6th field represents year
date command can be used to display each field separately. This can be done using format specifier.Each format is preceded by + symbol followed by % operator and a single character describing the format.
a. date +%m //display month in numerical form
$ date +%m
01
$
01
$
b. date +%h //display month name
$ date +%h
Jan
$
Jan
$
c. date +"%h %m" //display month name and its numeric equivalent
$ date +"%h %m"
Jan 01
$
Jan 01
$
other format specifiers are:
1. d - The day of the month(1-31).
2. y - The last two digit of the year.
3. H,M and S - The hour , minute and second respectively.
There are many more you can see them by typing date --help on the terminal.
3. --help : --help can be used with any command to know their options .
Syntax
command-name --help
Example
--> date --help
--> cal --help
4. man command can be used as an alternative of --help option. It is used to display documentation of the command. This include options used with command and other information also.
Syntax
man command-name
Example
--> man date
--> man cal
* press q to exist from man page.
5. info : info command serve the same purpose which man command do , but it contain lot more information than man does.
Syntax
info command-name
Example
--> info date
--> info cal
* press q to exist from info page
Difference between man and info
1. man contain less content than info.
2. man is older and info is newer and slowly replacing man.
3. man is typically a single page while info is spread across multiple pages and info allow navigation while man does not.
If You Liked This Post Please Take a Time To Share This Post
0 comments:
Post a Comment