Basic commands
5:35 AM
By
Rajashekar Reddy BusiReddy
0
comments
Basic commands
A
virtual console is a command line where you can log into and control Linux. As
RHEL is a multi terminal operating system, you can log into Linux, even with
the same user ID, several times.
There are 7 terminals for
Linux. 6 terminals are non - GUI and 1 terminal for GUI access. You can login
to each terminal using Alt + Ctrl + F1 , F2, .. F7. Each terminals will request
your username and password for login. If you want to use the shell in the
graphical interface (GUI), press Alt + F2 and type "konsole". As a
user you will have permission to access only your /home/user directory and
other directories in it.
pwd command:
pwd - Print Working Directory. pwd command prints the full filename of the current working directory.
Syntax
The Syntax is pwd [options]
Options
pwd - Print Working Directory. pwd command prints the full filename of the current working directory.
Syntax
The Syntax is pwd [options]
Options
-P
|
The pathname printed will not contain symbolic links.
|
-L
|
The pathname printed may contain symbolic links.
|
Example:
Displays the current working directory.
root@raju~]#pwd
If you are working in home directory
then, pwd command displays the current working directory as /home.
who command
who command can list the names of users currently logged in, their terminal, the time they have been logged in, and the name of the host from which they have logged in.
Syntax
The Syntax is
who [options] [file]
Options
who command can list the names of users currently logged in, their terminal, the time they have been logged in, and the name of the host from which they have logged in.
Syntax
The Syntax is
who [options] [file]
Options
am i
|
Print the username of the invoking user, The 'am' and 'i'
must be space separated.
|
-b
|
Prints time of last system boot.
|
-d
|
print dead processes.
|
-H
|
Print column headings above the output.
|
-i
|
Include idle time as HOURS:MINUTES. An idle time of .
indicates activity within the last minute.
|
-m
|
Same as who am i.
|
-q
|
Prints only the usernames and the user count/total no of
users logged in.
|
-T,-w
|
Include user's message status in the output.
|
cal command:
cal command is used to display the calendar.
Syntax
The Syntax is
cal [options] [month] [year]
Options
cal command is used to display the calendar.
Syntax
The Syntax is
cal [options] [month] [year]
Options
-1
|
Displays single month as output.
|
-3
|
Displays prev/current/next month output.
|
-s
|
Displays sunday as the first day of the week.
|
-m
|
Displays Monday as the first day of the week.
|
-j
|
Displays Julian dates (days one-based, numbered from
January 1).
|
-y
|
Displays a calendar for the current year.
|
date command
date command prints the date and time
Syntax The Syntax is
date [options] [+format] [date]
Options
date command prints the date and time
Syntax The Syntax is
date [options] [+format] [date]
Options
-a
|
Slowly adjust the time by sss.fff seconds (fff represents
fractions of a second). This adjustment can be positive or negative.Only
system admin/ super user can adjust the time.
|
-s date-string
|
Sets the time and date to the value specfied in the
datestring. The datestr may contain the month names, timezones, 'am', 'pm',
etc.
|
-u
|
Display (or set) the date in Greenwich Mean Time
(GMT-universal time).
|
Format:
%a
|
Abbreviated weekday(Tue).
|
%A
|
Full weekday(Tuesday).
|
%b
|
Abbreviated month name(Jan).
|
%B
|
Full month name(January).
|
%c
|
Country-specific date and time format..
|
%D
|
Date in the format %m/%d/%y.
|
%j
|
Julian day of year (001-366).
|
%n
|
Insert a new line.
|
%p
|
String to indicate a.m. or p.m.
|
%T
|
Time in the format %H:%M:%S.
|
%t
|
Tab space.
|
%V
|
Week number in year (01-52); start week on Monday.
|
Example:
1.
date command
date
The above command will print wed Nov 28 10:52:34 IST 2012
2.
To use tab space:
date +"Date is %D %t Time is %T"
The above command will remove space and print as
Date is 11/28/12 Time is 10:52:34
Date is 11/28/12 Time is 10:52:34
3.
To set the date,
date -s "11/28/2012 11:37:23"
The above command will print wed Nov 28 11:37:23IST 2012
clear command This
command clears the terminal screen.
Syntax
Syntax
The Syntax isclear
Options
Options
There is no options for clearscreen
command.
Example
Example
1. clear
clear
command clearscreen like cls command.
2.
You can also have alias for this command.
alias c='clear'
c is the alias name for clear command.
hostname
command
hostname
specifies the name of the host.
Syntax The Syntax is
hostname [-a | -d | -f | -h | -i | -s]
Options
Syntax The Syntax is
hostname [-a | -d | -f | -h | -i | -s]
Options
-a
|
Displays the alias name of the host, if used.
|
-d
|
Displays DNS domain name
|
-f
|
Displays fully qualified domain name.
|
-h
|
Displays help message.
|
-i
|
Displays IP address of the host.
|
-s
|
Trim domain name from display.
|
Example
1.
hostname command
hostname
The
above command will print as raju.com
2.
hostname -a
The
above command will remove space and print as raju
3.
To display DNS domain name
hostname -d
The
above command will print as .com
Leave Your Comment Below If You Like This Post
0 comments: