Basic Unix commands
pwd,tty,stty,uptime,finger
pwd command is used to print name of current/working
directory
tty command is used to print the file name of the
terminal connected to standard input
stty command is used to change and print terminal line
settings
stty –a command is usedto print all current settings in
human-readable form
uptime - Tell how long the system has been running.
finger command is used tocheck the user information
(click on image for fullscreeview and refresh to return)
Example : pwd,tty,stty,uptime,finger
chfn,who
Some useful options of who command :
uname,cal,clear
uname - print system information
Some useful options of uname comand :
-a print all information
-n print the network node hostname
-r print the kernel release
-v print the kernel version
-m print the machine hardware name
-p print the processor type
cal - displays a calendar
Cal displays a simple calendar. If arguments are not specified, the current month is displayed.The options are as follows:
-1 Display single month output. (This is the default.)
-3 Display prev/current/next month output.
-s Display Sunday as the first day of the week. (This is the default.)
-m Display Monday as the first day of the week.
clear - clear the terminal screen
hostname, domainname , dnsdomainname , nisdomainname , ypdomainname
Some useful options of
hostname command :
-s short host name
-a alias names
-i addresses for the hostname
-f long host name (FQDN)
-d DNS domain name
-y NIS/YP domainname
domainname - show or set the system’s NIS/YP domain name
dnsdomainname - show the system’s DNS domain name
nisdomainname - show or set system’s NIS/YP domain name
ypdomainname - show or set the system’s NIS/YP domain name
Answer yourself,the following
Questions ???
- Login
- Change password ( Passwd )
- Check the date and time (date)
- Check the present working directory (pwd)
- Check the teminal ( tty& stty)
- Check the system uptime ( uptime)
- Check the user details (finger)
- Change the user details (chfn)
- Get details of current loggedinusers(who)
- Get the identification details ( id )
- Check name,flavour of os ( uname )
- Check the calendar ( Cal )
- Banner ( banner )
- host name ( hostname )
- clear ( To clear screen )
passwd
passwd command is used to
(click on image for fullscreeview and refresh to return)
passwd command is used to
update/change user’s authentication
token(s).
Root user can change/reset the
password for other users .
In production environment generally
password expires in 90 days or after 1
year.
date
date command is used to print or set the system date
and time
and time
Syntax: date +”<options>”
Some useful options :
%blocales abbreviated month name
(Jan..Dec)
%d day of month (01..31)
%D date (mm/dd/yy)
%F same as %Y-%m-%d
%H hour (00..23)
%I hour (01..12)
%m month (01..12)
%M minute (00..59)
%S second (00..60)
%T time, 24-hour (hh:mm:ss)
%y last two digits of year
%Y year (1970...)
Date - Example
pwd,tty,stty,uptime,finger
pwd command is used to print name of current/working
directory
tty command is used to print the file name of the
terminal connected to standard input
stty command is used to change and print terminal line
settings
stty –a command is usedto print all current settings in
human-readable form
uptime - Tell how long the system has been running.
finger command is used tocheck the user information
(click on image for fullscreeview and refresh to return)
Example : pwd,tty,stty,uptime,finger
chfn,who
chfn - change your finger information
who - show who is logged onSome useful options of who command :
-b time
of last system boot
-i add idle time as HOURS:MINUTES
-r print current runlevel
-u list users logged in
Run
levels
•The runlevels used by RHS are:
•0 - halt (Do NOT set initdefault
to this)
•1 - Single user mode
•2 - Multiuser, without NFS (The same as 3, if
you do not have networking)
•3 - Full multiuser mode
•4 - unused
•5 - X11
•6 - reboot (Do NOT set initdefault
to this)
Example :
chfn,who,whoami,w
whoami - print effective userid
w - Show who is logged on and what they are doing.
id - print real and effective UIDs and GIDs
Some useful options of id command :
-g print only the effective group ID
-G print all group IDs
-n print a name instead of a number
(click on image for fullscreeview and refresh to return)
uname,cal,clear
uname - print system information
Some useful options of uname comand :
-a print all information
-n print the network node hostname
-r print the kernel release
-v print the kernel version
-m print the machine hardware name
-p print the processor type
cal - displays a calendar
Cal displays a simple calendar. If arguments are not specified, the current month is displayed.The options are as follows:
-1 Display single month output. (This is the default.)
-3 Display prev/current/next month output.
-s Display Sunday as the first day of the week. (This is the default.)
-m Display Monday as the first day of the week.
clear - clear the terminal screen
hostname, domainname , dnsdomainname , nisdomainname , ypdomainname
hostname - show or set the system’s host name
-s short host name
-a alias names
-i addresses for the hostname
-f long host name (FQDN)
-d DNS domain name
-y NIS/YP domainname
domainname - show or set the system’s NIS/YP domain name
dnsdomainname - show the system’s DNS domain name
nisdomainname - show or set system’s NIS/YP domain name
ypdomainname - show or set the system’s NIS/YP domain name
Answer yourself,the following
Questions ???
1)How to get the OS name ?
2)How to know since when the
server is up ?
3)How to get the last boot
time of server ?
4)How to get the details of
user ?
5)How to know who all are
currently logged in and
which program they are executing currently ?
which program they are executing currently ?
6)How to get the current
date and time ?
7)How to get yesterday’s
date ?
8)How to get tomorrow’s date
?
9)How to print the date in
the following format ?
Todays date
is : YYYY-mm-dd:HH-MM-SS
10) How to change the users information ?
11) How to get the id of a particular user ?
12) How to know the present working directory
?
13) How to know which terminal is associated
with
your current session ?
your current session ?
14) How to get the current terminal settting
details ?
15) How to see the calendar of March 1999 ?
16) How to see the calendar for the year 1992
?
17) How to get the hostname ?
18)How to get the FQDN (Fully Qualified
Domain Name) ?
No comments:
Post a Comment