Vous êtes sur la page 1sur 2

BASIC UNIX COMMANDS

1) How to know since when the server is up ?uptime


2) How to get the last boot time of server ?who -b
3) How to get the details of user ?who -u
4) How to get the OS name ?uname -n
5) How to know who all are currently logged in and which program they are executing currently ?who -w
6) How to get the current date and time ?date
7) How to get yesterdays date ?date d yesterday
8) How to get tomorrows date ? date d tomorrow
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 ? chfn
11) How to get the id of a particular user ? whoami
12) How to know the present working directory ? pwd
13) How to know which terminal is associated with your current session ? tty
14) How to get the current terminal settting details ?
15) How to see the calendar of March 1999 ?cal 3 1999
16) How to see the calendar for the year 1992 ?cal 1992
17) How to get the hostname ?hostname
18) How to get the FQDN ( Fully Qualified Domain Name) ? hostname -f
19) How to display the date in aug 08 format ? date + %b %m OR date + %h %m
20) Where is the password stored and in which format ?
Ans: Password is stored in encrypted form in the file called shadow under /etc directory.
21)Observe the calendar of the year 1752 . Do you notice anything unusual ?

BASIC UNIX COMMANDS


Ans : The Grogorean Reformation is assumed to have occurred in 1752 on the 3rd of September. By this time ,
most countries had recognized (although a few did not recognized until the early 1900s.) Ten days following date
were eliminated by the reformation so that calendar for that month is a bit unusual.
22) Interpret the output of $ who am I r
Sharma

pts/10 Aug 1 07:56 (pc123.heavens.com ) ?

Ans: The first column shows the username ( or user id) working on the system. The second column shows the
device name of the respective terminal . This is actually file name associated with terminal.The third, fourth and
fifth columb says the date and time of logging in. The last column says the machine name where the user logged
in.
23) Display the calendar of six months ?
Ans: $ for month in 6 7 8 9 10 11;do cal $month $(date +%Y);done;
24) How to display the calendar of previous 2 months ?
Ans : Let say current month is September(09).
$ for month in 7 8; do cal $month 2014;done;
25)How to set the system date and time ?
Ans: For that u must be log in as root (/) to set /change date under unix. Syntax date MMddhhmm
Where MM :two digit numeric month
Hh:hour

dd: two digit numeric date

mm:minute

Example : To set date to April 27 2010 8:00 AM under HP , AIX, Sun Solarish or Unix like O/S
Date 042708002010
26)

Vous aimerez peut-être aussi