Showing posts with label unix basic commands. Show all posts
Showing posts with label unix basic commands. Show all posts

Wednesday, September 28, 2011

General Purpose utilities commands in Linux


1. Calender
cal: Command to see calender for any specific month or a complete year
Usage: 
$ cal [ [month] year]
Example:
$ cal april 2009
Output:
April 2009
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

2. Date
date: displays the current date
Usage:
$ date
Output:
Tue Apr 21 21:33:49 IST 2009
user$ date +"%D %H:%M:%S"
04/21/09 21:35:02
Options:
d - The da of the month (1-31)
y - The last two digits of the year
H,M,S - Hour Minute and second respectively
D - the date in mm/dd/yy

3. echo
echo: Print message on the terminal
Usage:
echo ""
Example:
$ echo "Welcome to the workshop"
Output:
Welcome to the workshop

4. printf
printf: Print the formatted message on the terminal
Usage:
printf ""
Example:
$ printf "the amount is %d\n" 100
Output:
the amount is 100

5. Calculator
bc: A text based calculator
Usage:
$ bc
2*10+20-9+4/2 [Input]
33 [Output]
[ctrl+d] [Quit]

xcalc is graphical based calculator

6. script
script command records your session and stores it in a file
Usage:
$ script
Script started, file is typescript
$ echo "this is a sample script"
this is a sample script
$ [ctrl+d]
Script done, file is typescript

By default if you dont specify any file name the contents will be stored in file name typescipt
Usage:
$ cat typescript
Script started on Tuesday 21 April 2009 10:07:00
$ echo "this is a sample script"
this is a sample script
$
Script done on Tuesday 21 April 2009 10:07:34 PM

7. passwd
passwd command allows you to change your password
Usage:
$ passwd
Changing password for user123.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

8. WHO: Who are the users?
who command tells you the users currently logged on to the system
Usage:
$ who
root     :0           Sep  4 22:47
root     pts/1        Sep  4 22:48 (:0.0)

9. man - The reference Manual
man displays the documentation for a command
Usage:
man
Example:
$ man ls
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the
none of -cftuvSUX nor --sort.